app icon indicating copy to clipboard operation
app copied to clipboard

forbidden field in model

Open dreamsbond opened this issue 6 years ago • 2 comments

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?

dreamsbond avatar Nov 19 '19 06:11 dreamsbond

something like

 protected $guarded = ['uuid'];

in laravel

dreamsbond avatar Nov 19 '19 10:11 dreamsbond

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.

dreamsbond avatar Nov 19 '19 10:11 dreamsbond