canDo('ytrrr.ordetr.view') && $user->isAdmin()) { return true; } return $ordetr->user_id == user_id() && $ordetr->user_type == user_type(); } /** * Determine if the given user can create a ordetr. * * @param UserPolicy $user * @param Ordetr $ordetr * * @return bool */ public function create(UserPolicy $user) { return $user->canDo('ytrrr.ordetr.create'); } /** * Determine if the given user can update the given ordetr. * * @param UserPolicy $user * @param Ordetr $ordetr * * @return bool */ public function update(UserPolicy $user, Ordetr $ordetr) { if ($user->canDo('ytrrr.ordetr.edit') && $user->isAdmin()) { return true; } return $ordetr->user_id == user_id() && $ordetr->user_type == user_type(); } /** * Determine if the given user can delete the given ordetr. * * @param UserPolicy $user * @param Ordetr $ordetr * * @return bool */ public function destroy(UserPolicy $user, Ordetr $ordetr) { return $ordetr->user_id == user_id() && $ordetr->user_type == user_type(); } /** * Determine if the given user can verify the given ordetr. * * @param UserPolicy $user * @param Ordetr $ordetr * * @return bool */ public function verify(UserPolicy $user, Ordetr $ordetr) { if ($user->canDo('ytrrr.ordetr.verify')) { return true; } return false; } /** * Determine if the given user can approve the given ordetr. * * @param UserPolicy $user * @param Ordetr $ordetr * * @return bool */ public function approve(UserPolicy $user, Ordetr $ordetr) { if ($user->canDo('ytrrr.ordetr.approve')) { return true; } return false; } /** * 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; } } }