<?php

namespace App\Http\Controllers\Concerns;

use App\Models\Club;
use App\Services\School\ClubDiscussionService;

trait AuthorizesClubAccess
{
    protected function authorizeClub(Club $club): void
    {
        $service = app(ClubDiscussionService::class);

        abort_unless($service->canAccess(auth()->user(), $club), 403);
    }
}
