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