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