Answers for "Laravel Route Group"

PHP
6

laravel Route::group definition

Route::group(['prefix'=>'accounts','as'=>'account.'], function(){
    Route::get('/', 'AccountController@index')->name('index');
    Route::get('connect', 'AccountController@connect')->name('connect');
});

Route::group(['prefix'=>'quotes','as'=>'quote.'], function(){
    Route::get('/', 'QuoteController@index')->name('index');
    Route::get('connect', 'QuoteController@create')->name('create');
});
Posted by: Guest on July-27-2020
1

Laravel Route Group

Route::group(['prefix' => 'post', 'middleware' => ['auth']], function(){
        Route::get('all','Controller@post');
        Route::get('user','Controller@post');
    })
Posted by: Guest on July-18-2021
2

laravel group routes

Route::group(['prefix' => 'admin'], function () {
    Route::get('users', function ()    {
        // Matches The "/admin/users" URL
    });
});
Posted by: Guest on December-14-2020
2

laravel route namespace and prefix

Route::prefix('admin')->group(function () {
    Route::get('/users', function () {
        // Matches The "/admin/users" URL
    });
});
Posted by: Guest on December-15-2020
0

laravel routes return view in web.php

Route::get("/page", function(){
   return View::make("dir.page");
});
Posted by: Guest on May-07-2020
0

none

Route Groups is an essential feature in Laravel, which allows you to group all the routes. Routes Groups are beneficial when you want to apply the attributes to all the route
  Here, we have used the group() function, which takes two parameters, as mentioned in the syntax.

  1-	array of attributes, string,Closure
  2-	callback function, string $routes
  	
	The first parameter is an associative array containing namespace, prefix, or middleware for the group of routes
	The second paramter is a callback function which contain the list of routes inside the group.
Syntax:
	Route::group( [ ] , callback); //syntax parameters (\Closure|string|array $attributes, \Closure|string $routes)
	Route::group( [ ] , function(){});

Group Without Naming:

	Route::group(
Posted by: Guest on January-01-1970

Browse Popular Code Answers by Language