<?php

namespace App\Http\Controllers;

use App\Domain\Training\Models\TrainingGroup;
use Illuminate\Support\Facades\Gate;

class GroupSchedulePrintController extends Controller
{
    public function __invoke(TrainingGroup $group)
    {
        Gate::authorize('groups.list');

        $group->load(['program', 'schedules', 'enrollments' => function ($q) {
            $q->where('status', 'active')->with('participant');
        }]);

        return view('print.group-schedule', compact('group'));
    }
}
