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