laravel routing

 how to call a file that is define in routes

routing types

Basic routeing

redirect routes

view routes

route parameters

named routes


without using controller

use route::view

routes/api.php-> api path

routes/web.php -> web application

we cwill give for every route with name, that name we will call in entire application

routes/console.php

routes/channels.php

route::get

Route::get('/menu', [UiController::class, 'menu'])->name('menu');

route::post

Route::post('/submit-contact', [UiController::class, 'contact'])->name('submit-contact');

in above u observer named routes

redirect from entered to named or defned

router:redirect('/here','/greeting');

route with parameters

Route::get('/add_to_cart/{id}', [UiController::class, 'cart'])->name('cart');


Route::match(['put', 'patch'], '/password/update/{id}',[UiController::class, 'password_update'])->name('password_update');


Route::view('/about', 'ui.about')->name('about');


Route::view('/about', 'ui.about',['name' =>'taylor','car' =>'my favorite car']);

Route::view('/about', 'ui.about',['car' =>'my favorite car']);

<?php echo $car ?> == {{ $car}}

rote::get('/'.function(){

return view('welcme');

});

route::any


rote::get('/'.function(){

return view('welcme');

});

named routes and route paramaters

Route::get('/user/{first_name}/{last_name}',function($first_name,$last_name){

return 'username is '. $first_name.''.$last_name;
})->name('profile);

url/user/vamsi/krishna

{{$first_name}}


php artisan route:cache


laravel routing assignment


 By which file route files are loaded automatically?

riute service provider


 Which method is used to register a route that responds to multiple specific HTTP verbs?

match


Which status code is returned by Route::redirect method by default?

302


No comments:

Post a Comment

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...