PHP code example of joskolenberg / eloquent-empty-date-nullifier
1. Go to this page and download the library: Download joskolenberg/eloquent-empty-date-nullifier 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/ */
joskolenberg / eloquent-empty-date-nullifier example snippets
use Illuminate\Database\Eloquent\Model;
use JosKolenberg\EloquentEmptyDateNullifier\NullifiesEmptyDates;
class Person extends Model
{
use NullifiesEmptyDates;
protected $dates = [
'date_of_birth',
];
}
$person = new Person();
$person->setRawAttributes([
'date_of_birth' => '0000-00-00',
]);
$person->date_of_birth; // = null