Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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;
    }
}

Comment

PREVIOUS NEXT
Code Example
Php :: php read sql 
Php :: php interface vs abstract class 
Php :: how to use xampp for php and mysql 
Php :: php sort custom function 
Php :: laravel raw query join many to many 
Php :: foreach in laravel 
Php :: login form in php 
Php :: how to get correct file or content mime type using/in php 
Php :: file upload in php mysql 
Php :: php echo variable 
Php :: define site url wordpress 
Php :: check if the link is image or url php 
Php :: echo php 
Php :: laravel create resource controller 
Php :: import storage laravel 
Php :: how to install symfony in windows 10 
Php :: passing parameters with route keyword in blade laravel 
Php :: php strict mode 
Php :: convert string to float in php 
Php :: laravel 8 decimal 
Php :: get term id by post id 
Php :: laravel controller in details 
Php :: php location header 
Php :: add custom attribute for validation errors laravel 
Php :: file upload permission in php 
Php :: php strftime datetime 
Php :: guzzle get request 
Php :: php remove first word from string 
Php :: laravel where 
Php :: php new line 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =