canDo('store_locator.store_locator.view') && $user->is('admin')) { return true; } return $user->id === $store_locator->user_id; } /** * Determine if the given user can create a store_locator. * * @param User $user * @param StoreLocator $store_locator * * @return bool */ public function create(User $user) { return $user->canDo('store_locator.store_locator.create'); } /** * Determine if the given user can update the given store_locator. * * @param User $user * @param StoreLocator $store_locator * * @return bool */ public function update(User $user, StoreLocator $store_locator) { if ($user->canDo('store_locator.store_locator.update') && $user->is('admin')) { return true; } return $user->id === $store_locator->user_id; } /** * Determine if the given user can delete the given store_locator. * * @param User $user * @param StoreLocator $store_locator * * @return bool */ public function delete(User $user, StoreLocator $store_locator) { if ($user->canDo('store_locator.store_locator.delete') && $user->is('admin')) { return true; } return $user->id === $store_locator->user_id; } /** * 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; } } }