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