<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;

class PembimbingSekolahMiddleware
{
    public function handle(Request $request, Closure $next)
    {
        if (!auth()->check() || !auth()->user()->isPembimbingSekolah()) {
            return redirect()->route('login')->with('error', 'Akses tidak diizinkan');
        }
        return $next($request);
    }
}