use AppHttpControllersUserController;
use AppModelsUser;
// Route definition...
Route::get('/users/{user}', [UserController::class, 'show']);
// Controller method definition...
public function show(User $user)
{
return view('user.profile', ['user' => $user]);
}
Route::get('user/{id}', function ($id) {
return 'User '.$id;
});
Route::get('user/profile', [UserProfileController::class, 'show'])->name('profile');
Route::view('/welcome', 'welcome');
Route::view('/welcome', 'welcome', ['name' => 'Taylor']);
Route::redirect('/here', '/there', 301);
Route::view('/welcome', 'welcome');
Route::view('/welcome', 'welcome', ['name' => 'Taylor']);
Route::redirect('/here', '/there');
// before: http://yourdomain.test/routename
secure_url(route("routename", ["querystring" => "something"], false));
// after: https://yourdomain.test/routename?querystring=something
Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) {
//
});
Laravel_Route::
# 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::get('/user/{id}/profile', function ($id) {
//
})->name('profile');
$url = route('profile', ['id' => 1, 'photos' => 'yes']);
// /user/1/profile?photos=yes
use IlluminateSupportFacadesRoute;
Route::get('/greeting', function () {
return 'Hello World';
});