Skip to content

Category: Laravel Code Snippets

Injecting data With Blade

// categoriesCount.blade.php @inject(‘categories’,’App\categories’) Total categories : {{ $categories->count(); }} or // routes.php view::composer(‘categories’,function($view){ $view->with(‘categories’,’App\categories’); }); // categoriesCount.blade.php Total categories : {{ $categories->count(); }}

Leave a Comment

Named Route Groups

Route::get(‘admin/home’,[‘as’ => ‘home’,function(){ echo ‘admin home’; }]); // view echo route(‘home’); // output : http://localhost/admin/home Route::group([‘prefix’ => ‘admin’],function(){ Route::get(‘home’,[‘as’ => ‘home’,function(){ echo ‘admin home’; }]);…

Leave a Comment