xxxxxxxxxx
Route::view('Url','PageName');
//here Url is the call word which pass from url
Route::get('Url',[Controller::class ,'FunctionName']);
//from this route you can access function of specific
//controller thourgh specific url route
Route::get('Url/{id}',[Controller::class ,'FunctionName']);
//if you want to pass specific id or any thing thorugh route you
//can use it{id} or{name} or {anything} means anything you want to access
xxxxxxxxxx
use Illuminate\Support\Facades\Route;
Route::get('/greeting', function () {
return 'Hello World';
});
xxxxxxxxxx
Route::get('user/{id}/profile', function ($id) {
//
})->name('profile');
$url = route('profile', ['id' => 1, 'photos' => 'yes']);
// /user/1/profile?photos=yes
xxxxxxxxxx
Route::get($uri, $callback);
Route::post($uri, $callback);
Route::put($uri, $callback);
Route::patch($uri, $callback);
Route::delete($uri, $callback);
Route::options($uri, $callback);
Route::match(['get', 'post'], '/', function () {
// ...
});
Route::any('/', function () {
// ...
});
//By default, Route::redirect returns a 302 status code. You may customize
//the status code using the optional third parameter:
Route::redirect('/here', '/there');
//you may use the Route::permanentRedirect method to return a 301 status
//code
Route::permanentRedirect('/here', '/there');
xxxxxxxxxx
use App\Http\Controllers\UserController;
Route::get('/user', [UserController::class, 'index']);
xxxxxxxxxx
Route::view('/welcome', 'welcome');
Route::view('/welcome', 'welcome', ['name' => 'Taylor']);
laravel routing
xxxxxxxxxx
# laravel routing
Route::post('/registration/store',[AuthenticationController::class,'store']); //v.8.0 - v.10
Route::get('/user', 'UserController@index'); //v.7.0
#group in routing
Route::group(['prefix'=>'accounts','as'=>'account.'], function(){
Route::get('/', 'AccountController@index')->name('index');
Route::get('connect', 'AccountController@connect')->name('connect');
});