Looking to hire Laravel developers? Try LaraJobs

laravel-nullable maintained by arkitecht

Description
Laravel 5 - Add nullable columns to models
Author
Last update
2024/07/08 18:22 (dev-master)
License
Links
Downloads
954

Comments
comments powered by Disqus

Laravel Nullable

Easily set model columns as nullable - to send null on insert and update when empty. For use when using foreign key, nullable, columns.

Quick Installation

You can install the package most easily through composer

composer require arkitecht/laravel-nullable

Using it in your model

Use the $nullable variable to define the nullable columns in your model. These will send null to the database when empty, rather than an empty string.

<?php

namespace App;

use Arkitecht\Nullable\Traits\Nullable;
use Illuminate\Database\Eloquent\Model;

class Test extends Model
{
    use Nullable;
    protected $nullable = ['null_column_one','null_column_two'...];
}
?>