glastree_on_gitea
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Routing\Controllers;
|
||||
|
||||
interface HasMiddleware
|
||||
{
|
||||
/**
|
||||
* Get the middleware that should be assigned to the controller.
|
||||
*
|
||||
* @return array<int,\Illuminate\Routing\Controllers\Middleware|\Closure|string>
|
||||
*/
|
||||
public static function middleware();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Routing\Controllers;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
/**
|
||||
* @phpstan-type NextClosure \Closure(\Illuminate\Http\Request): \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
class Middleware
|
||||
{
|
||||
/**
|
||||
* Create a new controller middleware definition.
|
||||
*
|
||||
* @param (\Closure(\Illuminate\Http\Request, NextClosure): \Symfony\Component\HttpFoundation\Response)|string|array $middleware
|
||||
* @param array<string>|null $only
|
||||
* @param array<string>|null $except
|
||||
*/
|
||||
public function __construct(public Closure|string|array $middleware, public ?array $only = null, public ?array $except = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the only controller methods the middleware should apply to.
|
||||
*
|
||||
* @param array|string $only
|
||||
* @return $this
|
||||
*/
|
||||
public function only(array|string $only)
|
||||
{
|
||||
$this->only = Arr::wrap($only);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the controller methods the middleware should not apply to.
|
||||
*
|
||||
* @param array|string $except
|
||||
* @return $this
|
||||
*/
|
||||
public function except(array|string $except)
|
||||
{
|
||||
$this->except = Arr::wrap($except);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user