for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Sfneal\Casts;
use Carbon\Carbon;
use DateTime;
use Exception;
use Vkovic\LaravelCustomCasts\CustomCastBase;
class CarbonCast extends CustomCastBase
{
/**
* Store value as time code string.
*
* @param mixed $value
* @return DateTime
*/
public function setAttribute($value): ?DateTime
return $value;
}
* Retrieve value as Carbon instance.
* @return Carbon
* @throws Exception
public function castAttribute($value): ?Carbon
return ! is_null($value) ? new Carbon($value) : null;