PHP code example of genealabs / laravel-null-carbon
1. Go to this page and download the library: Download genealabs/laravel-null-carbon 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/ */
genealabs / laravel-null-carbon example snippets
use GeneaLabs\LaravelNullCarbon\NullCarbon;
use Illuminate\Support\Carbon;
class MyModel
{
protected $dates = [
'published_at',
];
public function getPublishedAtAttribute() : Carbon
{
return $this->published_at
?: new NullCarbon;
}
}