In my laravel project, I want set a random default value for each new created record.
According of this Doc, I try this:
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;
class User extends Authenticatable
{
protected $fillable = [
'access_token'
];
protected $attributes = [
'access_token' => str::uuid()
];
}
But I get error for protected $attributes line
"Constant expression contains invalid operations"