mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-25 00:04:33 +02:00
25 lines
600 B
PHP
25 lines
600 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\GraphQL\Middleware;
|
|
|
|
use Closure;
|
|
use GraphQL\Type\Definition\ResolveInfo;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Rebing\GraphQL\Error\AuthorizationError;
|
|
use Rebing\GraphQL\Support\Middleware;
|
|
|
|
class AuthMutation extends Middleware
|
|
{
|
|
/**
|
|
* @param array<string, mixed> $args
|
|
*/
|
|
public function handle($root, array $args, $context, ResolveInfo $resolveInfo, Closure $next)
|
|
{
|
|
throw_unless(Auth::check(), AuthorizationError::class, 'Unauthenticated.');
|
|
|
|
return $next($root, $args, $context, $resolveInfo);
|
|
}
|
|
}
|