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