From 5b78e703b17824ca1fdee7745764d5032fba345a Mon Sep 17 00:00:00 2001 From: Bostjan Oblak Date: Mon, 8 Feb 2016 12:04:14 +0100 Subject: [PATCH] laravel 5.1 lock, ready for tag --- composer.json | 4 +- src/RouteExplorerServiceProvider.php | 54 ++++++++++--------- src/app/Http/Controllers/ListController.php | 58 +++++++++++---------- 3 files changed, 61 insertions(+), 55 deletions(-) diff --git a/composer.json b/composer.json index 240c644..6f9d1a1 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Laravel 5 route explorer", "license": "MIT", "keywords": ["laravel", "laravel 5", "route explorer", "route list" ], - "homepage": "https://github.com/Media24si/RouteExplore", + "homepage": "https://github.com/Media24si/RouteExplorer", "authors": [ { "name": "Bostjan Oblak", @@ -12,7 +12,7 @@ ], "require": { "php": ">=5.4.0", - "laravel/framework": "5.*" + "laravel/framework": "5.0.* || 5.1.*" }, "autoload": { "psr-4": { diff --git a/src/RouteExplorerServiceProvider.php b/src/RouteExplorerServiceProvider.php index 463eb32..a177c66 100644 --- a/src/RouteExplorerServiceProvider.php +++ b/src/RouteExplorerServiceProvider.php @@ -4,32 +4,34 @@ use Illuminate\Support\ServiceProvider; -class RouteExplorerServiceProvider extends ServiceProvider { +class RouteExplorerServiceProvider extends ServiceProvider +{ - /** - * Bootstrap the application services. - * - * @return void - */ - public function boot() - { - include __DIR__ . '/app/Http/routes.php'; - } + /** + * Bootstrap the application services. + * + * @return void + */ + public function boot() + { + include __DIR__ . '/app/Http/routes.php'; + } - /** - * Register the application services. - * - * @return void - */ - public function register() - { - $this->registerViews(); - } + /** + * Register the application services. + * + * @return void + */ + public function register() + { + $this->registerViews(); + } - /** - * Register package views - */ - private function registerViews() { - $this->loadViewsFrom(__DIR__ . '/resources/views/', 'RouteExplorer'); - } -} \ No newline at end of file + /** + * Register package views + */ + private function registerViews() + { + $this->loadViewsFrom(__DIR__ . '/resources/views/', 'RouteExplorer'); + } +} diff --git a/src/app/Http/Controllers/ListController.php b/src/app/Http/Controllers/ListController.php index e88ffbc..2b01e06 100644 --- a/src/app/Http/Controllers/ListController.php +++ b/src/app/Http/Controllers/ListController.php @@ -1,43 +1,47 @@ -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]); - } -} \ No newline at end of file + return view('RouteExplorer::list.route-groups', ['routes' => $routes_array]); + } +}