app
app copied to clipboard
forbidden field in model
I have a scenario where the UUID should be being created or updated by the user. Is there any declaration exists for making the UUID only readable so to restrict user from creating and updating it?
something like
protected $guarded = ['uuid'];
in laravel
and followed by the guarded field.
is it possible to achieve
class User extends Model
{
public static function boot()
{
parent::boot();
self::creating(function($model){
// ... code here
});
self::created(function($model){
// ... code here
});
self::updating(function($model){
// ... code here
});
self::updated(function($model){
// ... code here
});
self::deleting(function($model){
// ... code here
});
self::deleted(function($model){
// ... code here
});
}
}
like in laravel?
I would like to generate UUID automatically at the time of resource creating.