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