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