pass data to controller from middleware

Solutions on MaxInterview for pass data to controller from middleware by the best coders in the world

showing results for - "pass data to controller from middleware"
Alina
29 Aug 2018
1<?php
2
3namespace App\Http\Middleware;
4
5use Closure;
6use Illuminate\Http\Request;
7
8class SetName
9{
10    public function handle(Request $request, Closure $next)
11    {
12        $request->name = 'Mr. Perfectionist';
13        return $next($request);
14    }
15}
16