This repository has been archived by the owner on Feb 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
61 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,47 @@ | ||
<?php namespace Media24si\RouteExplorer\app\Http\Controllers; | ||
<?php | ||
|
||
namespace Media24si\RouteExplorer\app\Http\Controllers; | ||
|
||
use Illuminate\Foundation\Bus\DispatchesCommands; | ||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Foundation\Validation\ValidatesRequests; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
class ListController extends BaseController { | ||
use DispatchesCommands, ValidatesRequests; | ||
class ListController extends BaseController | ||
{ | ||
use DispatchesCommands, ValidatesRequests; | ||
|
||
public function routes() { | ||
$routes = self::$router->getRoutes(); | ||
return view('RouteExplorer::list.routes', ['routes' => $routes]); | ||
} | ||
public function routes() | ||
{ | ||
$routes = self::$router->getRoutes(); | ||
return view('RouteExplorer::list.routes', ['routes' => $routes]); | ||
} | ||
|
||
|
||
public function matchRoute() { | ||
$path = '/routes'; | ||
$method = 'GET'; | ||
public function matchRoute() | ||
{ | ||
$path = '/routes'; | ||
$method = 'GET'; | ||
|
||
$request = Request::create($path, $method); | ||
$request = Request::create($path, $method); | ||
|
||
// match route or return 404 not found | ||
$match = self::$router->getRoutes()->match($request); | ||
// match route or return 404 not found | ||
$match = self::$router->getRoutes()->match($request); | ||
|
||
dd($match); | ||
} | ||
dd($match); | ||
} | ||
|
||
public function routeGroups() { | ||
$routes = self::$router->getRoutes(); | ||
public function routeGroups() | ||
{ | ||
$routes = self::$router->getRoutes(); | ||
|
||
foreach( $routes as $route ) | ||
{ | ||
$prefix = ($route->getPrefix() !== null) ? $route->getPrefix() : "/"; | ||
$routes_array[$prefix][] = $route; | ||
} | ||
foreach ($routes as $route) { | ||
$prefix = ($route->getPrefix() !== null) ? $route->getPrefix() : "/"; | ||
$routes_array[$prefix][] = $route; | ||
} | ||
|
||
ksort($routes_array); | ||
ksort($routes_array); | ||
|
||
return view('RouteExplorer::list.route-groups', ['routes' => $routes_array]); | ||
} | ||
} | ||
return view('RouteExplorer::list.route-groups', ['routes' => $routes_array]); | ||
} | ||
} |