Your Help Group

How to fetch data from database in route file in laravel

This technique is called flexible routing in laravel. In this we fetch all data from table inside route file without creating controller and model.

Code Block Example

					    
                            Route::get('orders', function()
{
    return View::make('orders.index')
        ->with('orders', Order::all());
});