public function view(UserPolicy $user, Gallery $gallery)
    {
        if ($user->canDo('gallery.gallery.view') && $user->isAdmin()) {
            return true;
        }

        return $gallery->user_id == user_id() && $gallery->user_type == user_type();
    }
public function view(UserPolicy $user, Gallery $gallery)
    {
        if ($user->canDo('gallery.gallery.view') && $user->isAdmin()) {
            return true;
        }

        return $gallery->user_id == user_id() && $gallery->user_type == user_type();
    }
public function view ( UserPolicy $ user , Gallery $ gallery ) { if ( $ user -> canDo ( 'gallery.gallery.view' ) && $ user -> isAdmin ( ) ) { return true ; } return $ gallery -> user_id == user_id ( ) && $ gallery -> user_type == user_type ( ) ; }
Determine if the given user can view the gallery.

@param UserPolicy $user
@param Gallery $gallery

@return bool
Determine if the given user can view the gallery .