canDo('turismo.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('turismo.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('turismo.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('turismo.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; } } }