Answers for "laravel model set new attribute"

PHP
0

laravel add attribute to model

$user = User::find(1);

// add occupation to user instance
$user->setAttribute('occupation', 'Web Developer');
Posted by: Guest on January-22-2021
0

laravel model set new attribute

public function getAvailabilityAttribute()
    {
        return $this->calculateAvailability();  
    }
Posted by: Guest on July-14-2021

Browse Popular Code Answers by Language