Route::matched PHP Method

matched() public static method

Register a route matched event listener.
public static matched ( string | callable $callback ) : void
$callback string | callable
return void
        public static function matched($callback)
        {
            \Illuminate\Routing\Router::matched($callback);
        }

Usage Example

Exemplo n.º 1
0
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
Route::matched(function ($route, $request) {
    $isInstalling = false;
    $config = app('siteConfig');
    //If is install route, skip config check
    if ($route->getName() == Config::get('app-installer::routeName')) {
        $isInstalling = true;
    }
    if (!Config::get('database') && !$isInstalling) {
        die(Response::configurationError("Seems like you are starting up! Go on. Install it! Refer to documentation for instructions.", "Installation not completed"));
    }
    //If config is empty and if the user is not running the installer, Show error
    if (!$config && !$isInstalling) {
        if (!DB::connection()) {
            return Response::configurationError("Oops! The database cant be read!", "Database Connection error");
        } else {
            return Response::configurationError("Oops! The database is not configured properly!", "Database Configuration error");
        }
    }
});
App::before(function ($request) {
    //dd($request->getPathInfo() == route(Config::get('app-installer::routeName'), [], false));
    App::singleton('siteConfig', function () {
        //Loading config
        $config = array(0);
        try {
All Usage Examples Of Route::matched