Skip to content

Instantly share code, notes, and snippets.

@0xMatt
Last active August 29, 2015 14:06
Show Gist options
  • Save 0xMatt/d6be86ce44f24fc2ec11 to your computer and use it in GitHub Desktop.
Save 0xMatt/d6be86ce44f24fc2ec11 to your computer and use it in GitHub Desktop.
<?php
use LaravelCms\Mvc\Resolver;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
$resolver = new Resolver(Request::path());
if($resolver->route())
{
$method = $resolver->getMethod();
$dispatch = rtrim($resolver->getNamespace(), "\\") . '\\' . ucfirst($resolver->getController()) . 'Controller' . '@' . $resolver->getAction();
#dd($dispatch); // string '\System\Controllers\Frontend\HomeController@index' (length=49)
// Example:
// URI: /
// Creates: Route::get('/', '\System\Controllers\Frontend\HomeController@index');
Route::$method($resolver->getRoute(), $dispatch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment