Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
laravel 5.1 lock, ready for tag
Browse files Browse the repository at this point in the history
  • Loading branch information
BostjanOb committed Feb 8, 2016
1 parent e672953 commit 5b78e70
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 55 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -12,7 +12,7 @@
],
"require": {
"php": ">=5.4.0",
"laravel/framework": "5.*"
"laravel/framework": "5.0.* || 5.1.*"
},
"autoload": {
"psr-4": {
Expand Down
54 changes: 28 additions & 26 deletions src/RouteExplorerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
/**
* Register package views
*/
private function registerViews()
{
$this->loadViewsFrom(__DIR__ . '/resources/views/', 'RouteExplorer');
}
}
58 changes: 31 additions & 27 deletions src/app/Http/Controllers/ListController.php
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]);
}
}

0 comments on commit 5b78e70

Please sign in to comment.