koel/app/Http/Middleware/AudioAuthenticate.php

18 lines
351 B
PHP
Raw Normal View History

2022-11-16 17:57:38 +00:00
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class AudioAuthenticate
{
public function handle(Request $request, Closure $next) // @phpcs:ignore
{
abort_unless($request->user()?->tokenCan('audio'), Response::HTTP_UNAUTHORIZED);
return $next($request);
}
}