public function view(UserPolicy $user, Calendar $calendar)
    {
        if ($user->canDo('calendar.calendar.view') && $user->hasRole('admin')) {
            return true;
        }

        if ($user->isUser() || $user->isAdmin()){
            return true;
        }

        return $user->id == $calendar->user_id && get_class($user) == $calendar->user_type;
    }
public function view(UserPolicy $user, Calendar $calendar)
    {
        if ($user->canDo('calendar.calendar.view') && $user->hasRole('admin')) {
            return true;
        }

        if ($user->isUser() || $user->isAdmin()){
            return true;
        }

        return $user->id == $calendar->user_id && get_class($user) == $calendar->user_type;
    }
public function view ( UserPolicy $ user , Calendar $ calendar ) { if ( $ user -> canDo ( 'calendar.calendar.view' ) && $ user -> hasRole ( 'admin' ) ) { return true ; } if ( $ user -> isUser ( ) || $ user -> isAdmin ( ) ) { return true ; } return $ user -> id == $ calendar -> user_id && get_class ( $ user ) == $ calendar -> user_type ; }
Determine if the given user can view the calendar.

@param User $user
@param Calendar $calendar

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