Files
portal/app/Policies/EventPolicy.php
2020-08-09 18:48:13 +02:00

95 lines
1.9 KiB
PHP

<?php
namespace App\Policies;
use App\Models\Event;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class EventPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\User $user
* @return mixed
*/
public function viewAny(User $user)
{
return true;
}
/**
* Determine whether the user can view the model.
*
* @param \App\User $user
* @param \App\Models\Event $event
* @return mixed
*/
public function view(User $user, Event $event)
{
return true;
}
/**
* Determine whether the user can create models.
*
* @param \App\User $user
* @return mixed
*/
public function create(User $user)
{
return true;
}
/**
* Determine whether the user can update the model.
*
* @param \App\User $user
* @param \App\Models\Event $event
* @return mixed
*/
public function update(User $user, Event $event)
{
return $user->id == $event->user_id;
}
/**
* Determine whether the user can delete the model.
*
* @param \App\User $user
* @param \App\Models\Event $event
* @return mixed
*/
public function delete(User $user, Event $event)
{
return $user->id == $event->user_id;
}
/**
* Determine whether the user can restore the model.
*
* @param \App\User $user
* @param \App\Models\Event $event
* @return mixed
*/
public function restore(User $user, Event $event)
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\User $user
* @param \App\Models\Event $event
* @return mixed
*/
public function forceDelete(User $user, Event $event)
{
return false;
}
}