laravel how to use mutators and $casts code example
Example: laravel mutators
class Video extends Model
{
public function setDurationInMinutesAttribute($value)
{
$this->attributes['duration_in_seconds'] = $value * 60;
}
public function setDurationInHoursAttribute($value)
{
$this->attributes['duration_in_seconds'] = $value * 60 * 60;
}
}