Today, We want to share with you Routing in laravel 6 Web Application Tutorial.In this post we will show you wordpress plugin require another plugin, hear for reverse routing in laravel we will give you demo and example for implement.In this post, we will learn about model view controller in laravel with an example.
Routing in laravel 6 Web Application Tutorial
There are the Following The simple About bootstrap directory in laravel is used to Full Information With Example and source code.
As I will cover this Post with live Working example to develop How to Structure Routes in Large Laravel 6 Projects?, so the functions in laravel controller is used for this example is following below.
How to Structure Routes in Large Laravel 6 Projects?
[php]
Route::get(‘/’, function(){
return “welcome”;
});
Route::post(‘loginMember’, ‘MemberController@loginMember’);
Route::group([‘middleware’ => [‘web’]], function () {
Route::get(‘member/logout’, ‘Auth\AuthController@getMemberLogout’);
Route::get(‘member/signin’, ‘Auth\AuthController@getMemberLogin’);
Route::post(‘auth/signin’, ‘Auth\AuthController@postLogin’);
Route::get(‘auth/logout’, ‘Auth\AuthController@getLogout’);
Route::group([‘middleware’ => [‘auth’]], function () {
Route::controller(‘member’, ‘MemberController’);
Route::get(‘member/dashboard’, ‘MemberController@dashBoard’);
Route::get(‘member/profile’, ‘MemberController@getMemberProfile’);
Route::post(‘member/profile’, ‘MemberController@postMemberProfile’);
});
});
[/php]
Laravel 6 Routing is one of the Best Navigation essential part or concepts in Server side.
[php]
Route:: get (‘/’, function () {
return ‘Welcome to index’;
});
[/php]
[php]
Route:: post(‘member/dashboard’, function () {
return ‘Welcome to Member dashboard’;
});
[/php]
[php]
Route:: put(‘member/add’, function () {
//
});
[/php]
[php]
Route:: delete(‘post/action_name’, function () {
//
});
[/php]
Required Parameters
[php]
Route :: get (‘product/{id}’, function ($id) {
echo ‘Product ‘.$id;
});
[/php]
Optional Parameters
[php]
Route :: get (‘product/{slug?}’, function ($slug = null) {
echo $slug;
});
[/php]
[php]
Route :: get (‘product/{title?}’, function ($title = ‘Mobile’) {
echo $title;
});
[/php]
Laravel 6 Structure routes/web.php File into Groups
[php]
Route::middleware([‘first’, ‘second’])->group(function () {
Route::get(‘/’, function () {
// Uses first & second Middleware
});
Route::get(‘member/profile’, function () {
// Uses first & second Middleware
});
});
[/php]
[php]
Route::prefix(‘member’)->group(function () {
Route::get(‘students’, function () {
// Matches The “/member/students” URL
});
});
Route::name(‘member.’)->group(function () {
Route::get(‘students’, function () {
// Route assigned name “member.students”…
})->name(‘students’);
});
[/php]
[php]
Route::name(‘member.’)->prefix(‘member’)->middleware(‘member’)->group(function () {
// …
});
Route::group([
‘name’ => ‘member.’,
‘prefix’ => ‘member’,
‘middleware’ => ‘auth’
], function () {
// …
});
[/php]
[php]
Route::group([
‘name’ => ‘member.’,
‘prefix’ => ‘member’,
‘middleware’ => ‘member’
], function () {
Route::get(‘students’, function () {
return ‘Student: student list’;
})->name(‘students’);
});
Route::group([
‘name’ => ‘student.’,
‘prefix’ => ‘student’,
‘middleware’ => ‘auth’
], function () {
Route::get(‘dp’, function () {
return ‘Student dp’;
})->name(‘dp’);
});
Route::group([
‘name’ => ‘backend.’,
‘prefix’ => ‘backend’
], function () {
Route::get(‘privacy-us’, function () {
return ‘privacy us page’;
})->name(‘privacy’);
});
[/php]
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about laravel route resource.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.