'collection', ]; public static $validationRules = [ 'event' => ['required', 'string'], 'batch' => ['nullable', 'uuid'], 'description' => ['nullable', 'string'], 'properties' => ['nullable', 'array'], ]; public function actor(): MorphTo { return $this->morphTo(); } public function subject(): MorphTo { return $this->morphTo(); } public function scopeForAction(Builder $builder, string $action): Builder { return $builder->where('action', $action); } /** * Scopes a query to only return results where the actor is a given model. */ public function scopeForActor(Builder $builder, IlluminateModel $actor): Builder { return $builder->whereMorphedTo('actor', $actor); } /** * Scopes a query to only return results where the subject is the given model. */ public function scopeForSubject(Builder $builder, IlluminateModel $subject): Builder { return $builder->whereMorphedTo('subject', $subject); } }