DekGenius.com
PHP
Creating a Basic Route in Laravel 8
use AppHttpControllersPagesController;
// Create route for About Page
Route::get('about-us', [PagesController::class, 'aboutPage'])->name('pages.about');
artisan in route in laravel
Artisan::call('cache:clear')
laravel route
Route::get('user/{id}', function ($id) {
return 'User '.$id;
});
How to create a route in laravel?
Route::get(‘/route’,function(){
Return “Something”;
})
laravel route
Route::get('user/profile', [UserProfileController::class, 'show'])->name('profile');
route() and with() in laravel
Route::get('user/{id}/profile', function ($id) {
//
})->name('profile');
$url = route('profile', ['id' => 1, 'photos' => 'yes']);
// /user/1/profile?photos=yes
laravel route name routes
Route::get('user/profile', function () {
//
})->name('profile');
laravel route
Route::view('/welcome', 'welcome');
Route::view('/welcome', 'welcome', ['name' => 'Taylor']);
laravel get route
Route::get('foo', function () {
return 'Hello World';
});
laravel get route
Route::get('/user', 'UserController@index');
routing in laravel
Route::view('/welcome', 'welcome');
Route::view('/welcome', 'welcome', ['name' => 'Taylor']);
how to create route in laravel
Route::match(['get', 'post'], '/', function () {
//
});
laravel route
// before: http://yourdomain.test/routename
secure_url(route("routename", ["querystring" => "something"], false));
// after: https://yourdomain.test/routename?querystring=something
laravel route
Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) {
//
});
laravel route
How to define route in laravel?
# Defines a route that lists all the users using GET method
Route::get('users', 'UserController@show')->name('users');
# Defines a route that creates user using POST method
Route::post('/users', 'UserController@create');
# Defines a route that update user partially using PATCH method
Route::patch('/users/:id', 'UserController@update');
# Defines a route that deletes user using DELETE method
Route::delete('/users/:id', 'UserController@delete');
route laravel
Route::get('/user/{id}/profile', function ($id) {
//
})->name('profile');
$url = route('profile', ['id' => 1, 'photos' => 'yes']);
// /user/1/profile?photos=yes
Basic route laravel
Route::get('/', function () {
return view('welcome');
});
Basic routing in laravel
use IlluminateSupportFacadesRoute;
Route::get('/greeting', function () {
return 'Hello World';
});
© 2022 Copyright:
DekGenius.com