🪁

Routing

Laravel works on MVC model ( model view and controller ) so the routing comes under the view section
So we can see in the image below
notion image
the view are under views section that are nothing but the php pages that are serve to the client side
now under routes→web.php we have to define the route that under which url we have to render which of the view .
two type of defining routes
1. Route::get('/about', function () { return view('about'); }); 2. Router::view("contanct","/contact");
 
 

Parameter pass

now if you want to pass parameters in the view and use them in the front-end part then you can use as
Router::get('/about/{name}',function($name){ return view('about',["name"=>$name]); })

How to access variable in the front-end

to access variable just use blade templating in the views pages
anyfile.blade.php →
{{$name}}
 
 

Redirect

if you want to redirect to any page you can just use return redirect (”view_name”)
notion image