Created
October 11, 2020 14:19
-
-
Save Aslam97/beefa10b69e27809d006fbad01a69b41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Support\Facades\Route; | |
class CurrentRouteMiddleware | |
{ | |
/** | |
* route | |
* | |
* @var mixed | |
*/ | |
private $route; | |
/** | |
* __construct | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
$this->route = Route::currentRouteName(); | |
} | |
/** | |
* handle | |
* | |
* @param mixed $request | |
* @param mixed $next | |
* @return void | |
*/ | |
public function handle($request, Closure $next) | |
{ | |
view()->share('route', $this->route); | |
return $next($request); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment