Routing in laravel 6 Web Application Tutorial

Rate this post

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]

READ :  Simple Way Laravel Installation step by step using composer

Route::get(‘/’, function(){
return “welcome”;
});

Route::post(‘loginMember’, ‘[email protected]’);
Route::group([‘middleware’ => [‘web’]], function () {
Route::get(‘member/logout’, ‘Auth\[email protected]’);
Route::get(‘member/signin’, ‘Auth\[email protected]’);
Route::post(‘auth/signin’, ‘Auth\[email protected]’);
Route::get(‘auth/logout’, ‘Auth\[email protected]’);

Route::group([‘middleware’ => [‘auth’]], function () {
Route::controller(‘member’, ‘MemberController’);
Route::get(‘member/dashboard’, ‘[email protected]’);
Route::get(‘member/profile’, ‘[email protected]’);
Route::post(‘member/profile’, ‘[email protected]’);

});
});
[/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]

READ :  Laravel Set and Get Global variables using controller

[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 () {

READ :  Get Url Parameter with Query String using VueJs

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.

Leave a Reply

Your email address will not be published.