finish event with log user participation

This commit is contained in:
2020-08-20 14:47:44 +02:00
parent 98fc72d6dc
commit 0a819fbadf
5 changed files with 134 additions and 5 deletions

View File

@@ -58,7 +58,11 @@ class EventPolicy
} else {
$testedUser = $event->guests()->where('users.id', $user->id)->first();
if ($testedUser !== null) {
return $testedUser->pivot->is_staff;
if($testedUser->pivot->is_staff) {
return $testedUser->pivot->is_staff;
} else if (!$event->private) {
return true;
}
}
}
return false;
@@ -99,4 +103,20 @@ class EventPolicy
{
return false;
}
/**
* Determine whether the guest can permanently delete invitation.
*
* @param \App\User $user
* @param \App\Models\Event $event
* @return mixed
*/
public function participation(User $user, Event $event)
{
$testedUser = $event->guests()->where('users.id', $user->id)->first();
if ($testedUser !== null) {
return true;
}
return false;
}
}