canDo('incidentreporting.incidentreporting.view') && $user->is('admin')) { return true; } return $user->id === $incidentreporting->user_id; } /** * Determine if the given user can create a incidentreporting. * * @param User $user * @param Incidentreporting $incidentreporting * * @return bool */ public function create(User $user) { return $user->canDo('incidentreporting.incidentreporting.create'); } /** * Determine if the given user can update the given incidentreporting. * * @param User $user * @param Incidentreporting $incidentreporting * * @return bool */ public function update(User $user, Incidentreporting $incidentreporting) { if ($user->canDo('incidentreporting.incidentreporting.update') && $user->is('admin')) { return true; } return $user->id === $incidentreporting->user_id; } /** * Determine if the given user can delete the given incidentreporting. * * @param User $user * @param Incidentreporting $incidentreporting * * @return bool */ public function destroy(User $user, Incidentreporting $incidentreporting) { if ($user->canDo('incidentreporting.incidentreporting.delete') && $user->is('admin')) { return true; } return $user->id === $incidentreporting->user_id; } /** * Determine if the user can perform a given action ve. * * @param [type] $user [description] * @param [type] $ability [description] * * @return [type] [description] */ public function before($user, $ability) { if ($user->isSuperUser()) { return true; } } }