Is it possible for a trait's boot method to set or modify a Model's attribute? The following non-working example illustrates what I am going for:
trait MyTrait {
public static function bootMyTrait(){
static::creating(function(Model $item){
$item->foo = 'foo';
});
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire