I want to insert a new event (like a party ...etc) that is related to a user, so I do this according to this tutorial:
$event = $owner->events()->create( $request->all() );
However, I'd like to override the create method before inserting so according to this tutorial I do this in the app\Event:
public static function create(array $attributes = [])
{
error_log('Im here.');
if ($attributes->privacy === "private") {
/////
}
else {
/////
}
$event = static::query()->create($attributes);
return $event;
}
My issue is that the code never reaches the new create method.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire