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