Esempio n. 1
0
 * unexpectedly included in Input::all() or Input::get(). Leaving it
 * in the input array could cause unexpected results if the developer
 * fills an Eloquent model with the input.
 */
unset($input[Request::spoofer]);
Input::$input = $input;
//Compatibility hack
set_log4php_env('ls_log_file', \Config::get('env.log_path') . '/content.log');
\Logger::configure(\Config::get('log4php'));
/**
 * Route the request to the proper route in the application. If a
 * route is found, the route will be called with the current request
 * instance. If no route is found, the 404 response will be returned
 * to the browser.
 */
Routing\Filter::register(require APP_PATH . 'filters' . EXT);
$loader = new Routing\Loader(APP_PATH, ROUTE_PATH);
$router = new Routing\Router($loader, CONTROLLER_PATH);
IoC::instance('laravel.routing.router', $router);
Request::$route = $router->route(Request::method(), URI::current());
if (!is_null(Request::$route)) {
    $new_relic->name_transaction(Request::$route->key);
    try {
        $response = Request::$route->call();
    } catch (\Exception $e) {
        $handler($e);
    }
} else {
    $new_relic->name_transaction('404');
    \Laravel\Routing\Filter::run(array('before'), array(), true);
    $response = \Response::json(['msg' => 'Not found'], 404);
Esempio n. 2
0
}
// --------------------------------------------------------------
// Determine the module that should handle the request.
// --------------------------------------------------------------
$segments = explode('/', Request::uri());
define('ACTIVE_MODULE', in_array($segments[0], Config::get('application.modules')) ? $segments[0] : 'application');
// --------------------------------------------------------------
// Determine the path to the root of the active module.
// --------------------------------------------------------------
define('ACTIVE_MODULE_PATH', ACTIVE_MODULE == 'application' ? APP_PATH : MODULE_PATH . ACTIVE_MODULE . '/');
// --------------------------------------------------------------
// Register the filters for the active module.
// --------------------------------------------------------------
Routing\Filter::register(require APP_PATH . 'filters' . EXT);
if (ACTIVE_MODULE !== 'application' and file_exists($filters = ACTIVE_MODULE_PATH . 'filters' . EXT)) {
    Routing\Filter::register(require $filters);
}
// --------------------------------------------------------------
// Call the "before" filter for the application and module.
// --------------------------------------------------------------
foreach (array('before', ACTIVE_MODULE . '::before') as $filter) {
    $response = Routing\Filter::call($filter, array(Request::method(), Request::uri()), true);
    if (!is_null($response)) {
        break;
    }
}
// --------------------------------------------------------------
// Route the request and get the response from the route.
// --------------------------------------------------------------
if (is_null($response)) {
    $route = Routing\Router::make(Request::method(), Request::uri(), new Routing\Loader(ACTIVE_MODULE_PATH))->route();