laravel middleware retun with data code example
Example 1: middleware in laravel
<?php
namespace App\Http\Middleware;
use Closure;
class BeforeMiddleware
{
public function handle($request, Closure $next)
{
// Perform action
return $next($request);
}
}
Example 2: middleware in laravel
<?php
namespace App\Http\Middleware;
use Closure;
class CheckType
{
public function handle($request, Closure $next)
{
// Perform action
return $next($request);
}
}