Skip to content

Commit

Permalink
corr RoleEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
NatachaH committed Feb 17, 2021
1 parent 87017a2 commit 4a4ffb7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Traits/HasAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ protected static function bootHasAccess()
{
if(request()->has('role'))
{
if($model->role->id != request()->role)
if(is_null($model->role))
{
RoleEvent::dispatch('created', $model);
} else if($model->role->id != request()->role) {
RoleEvent::dispatch('updated', $model);
}
$model->role()->associate(request()->role);
Expand Down

0 comments on commit 4a4ffb7

Please sign in to comment.