PHP code example of mr-feek / eloquent-null-casts

1. Go to this page and download the library: Download mr-feek/eloquent-null-casts library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mr-feek / eloquent-null-casts example snippets

 php
 declare(strict_types=1);

namespace MrFeek\EloquentNullCasts\Tests\data;

use Illuminate\Database\Eloquent\Model;
use MrFeek\EloquentNullCasts\CastsNullAttributes;

final class User extends Model
{
    use CastsNullAttributes;
    
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);

        $this->casts = [
            'deleted' => 'boolean',
        ];
    }
}
 php
 declare(strict_types=1);

namespace MrFeek\EloquentNullCasts\Tests\data;

use Illuminate\Database\Eloquent\Model;
use MrFeek\EloquentNullCasts\CastsNullAttributesModel;

final class User extends CastsNullAttributesModel
{
    protected $casts = [
        'deleted' => 'boolean',
    ];
}