Routing Through Buttons and Anchor Tags
Note- In the entire blog bootstrap 5 is used.
How to use routing through buttons and anchor tags the entire code is given below.
// This is navbar
// this button present in customers data table page
// routes>web.php
Route::get('/', function(){
return view('index');
});
Route::get('/register', [registrationController::class, 'index']);
Route::post('/register', [registrationController::class, 'register']);
Route::get('/customer/create', [customerController::class, 'index'])->name('customer.create');
Route::post('/customer', [customerController::class, 'store']);
Route::get('/customer', [customerController::class, 'view']);
{{url('/')}} This is first routing method it is used to pass urls as it is, ->name('customer.crate') is a second method to route pages. In this method we can give the url name. Do not need to use default urls. In case if main url change it will not effect to the url which is passed to other button or anchor tag.
Comments
Post a Comment