Laravel route with parameters | laravel tutorial

  • routes\web.php
  • resources\views\ViewDemo.blade.php
Laravel route with parameters | laravel tutorial


  •  routes\web.php

Route::get('/Viewdemo/{name}', function ($name) {
    return view('Viewdemo',['name'=>$name]);
});

Route::get('/ViewControllers/{name}',[ViewControllers::class,'index']);


app\Http\Controllers\ViewControllers.php

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ViewControllers extends Controller
{
    public function index($name){
        return view('ViewDemo',['name'=>$name]);
    }
}



resources\views\ViewDemo.blade.php

<h1>Wel-come {{ $name }}</h1>


Hi everyone welcome back to my channel my name is on it and in this letter you would have to do didn't even learn about the view what is the U. haul we can make a call we can call it and how we can bust that deductible you will see everything that is related to the view in light of it so well this is my output screen here you can see that and this is my coding scheme he'd be able to make an example for the view so now first question is that what is view source view basically a part of NBC here you can just pronounce it model view controller type soul. 


View is basically present in the letter read as well as any MVC framework like Zane or tickets B. Y. I. everything would have looked through so what we were doing the view we will put a what it's the end of the block in the view that we want to show to the user so here you can see that. 

The a lot of a local and some text and some link and somebody comes these up everything is present inside the laravel view so if you just want to check it then you can check it inside the source. Few and welcome.blade with PHP hi this space it's just done date look this out sold now the question is how we can make the view and how we can just show the.

 Great to have you here so for that I am just going to. Create a new file inside the views and let's make a new file to let's say my real name is so Juventus.. It. Zdummyz.P. H. B. thank so please keep in mind blade is actually not a part of NBC Orton I denied that it's possible for you this is the templating engine and we just provided a light bill lot of it right so we will learn about the blade or $10000000000 so in upcoming videos but in this we need to focus only on the field so on this spot I'm just going to make some text like. Hello users right. 

So and now I just want to see this the file as an output here so that we need to make up view order we can call it from the so we can just make a probably 40 or we can escalate from the controller will see both of the the whole weekend escorted from that opening and as good as a whole we can call it from the controller but first of all let me check it out from the property so now let's go to the routes file fabric PHP and just create so first of all you can discipline if they so choose the files with dope welcome and now you will find that in just 350 you would basis fender right so by December because at the base you out of which is that is a normal like bees like home and abroad and use it that's why when a base you want to be able to see what page.

 Select the doesn't implicate. You can again see a welcome page and now let's make order out 48 so you can just make out like this view. You can make it get and then they get let's sell. Boss here for you I don't like user and in the second bedroom meter. You can just make them function. Right we call it anonymous function because this function don't have any name that's why this is anonymous the study done. View and here again fortieth. A 30.

 He was inside your own men need to mention here a blade or PHP this is but automatically understand by the latter so now let's prepare. Juventus right okay when I decided to use a. So just you can't make it closer use it here and other users view is tender right so there is a one more wicket blue book but I would like this you can just directly simply prepared. Route. View your U. R. L.. And. You have in your name right and if you have but at the same. But. This the simplest actually have a limitation that we kind of busted it up from the you wanted to. 


View with this index so that I'm just going to make a comment and here I am going to put him out of bed on me don't let go. Name. What I'll do whatever you want. The last name and like spots people don't you and the second but I'm retired let's make an edit and this book here name. As in key and value will be though the last name right now on the blade of PSP to simply put tail. Doliver name. 

Right. And here you can see that we are able to get. User name or select hello unable hello Sam whatever you want right and even you can change this name like user and if you just changed his name he was he here then you just need to make here shoes are also right you can put any name for the etiquette this is still working fine. 

So now of what is the next thing that we learn how we can make of you what is the view how we can go to talk about that at all but yet we did not see that hold we can call it from the controller right so for that I'm just going to make one line and when to make the control of the site the H. B. at the San. Make controller. And controller name can be used as controller. And then the other component is created inside the app. At the DP controller and Haiti's tight so we can make a function hill so let's put a function name like. Lord view because we want to load a lot of you via make it a ton. View an overhead view file name Regis users.

 Like this right hander we are. Although not actually passing the data here so that I am just a moment to get out and this right here. Hello if. Froome. You will survive anything that you want with a hill and now let's sell this book here 01 more thing that we need to just mention here proud for this controller right so let's so moved to November to beach be. And define a route for. Underwriters so but before that we need to imported through decided use. App. S. T. T. P.. Controllers. 


And control of name is. Users controller. 8 semicolon and did not just a simple rule 40. Route. N. the. You can just prepare a get pretty close to. And the just the. I'm in the first. View fraud and just put here to user and in the second benefit that let's put their up keyboard and controller name. Colon colon. And to end the call and we can put it plus and. In the second TV can just put it out function images load of you. And to simply click right here in order to. Make it semicolon at the last right so now let's see it is working fine or not. How you can see that this is still working fine that's great so how we can foster the doll from controller to the view in all right so for that you can do who thinks you can just put the some standing that they had like bola up like you can simply put their name. Like. Name. Can be a little. Citigroup right and you can just fetched here like hello. The dollar name. Right and you can refresh it and even you can pass the this data from the U. I don't go to school for that you need to just past the. But I mean that S. the end global so food is prepared. Latin name. And 9 the controller you can just simply Portela dollar name. And here my bath. Just use the dollar name as the state and a place of static name. And now you can see that if you put him Bruce you can see that hello Bruce hello Tony. 

Hello Peter. Right so this is the VA that how we can use the view and we can call it from the controller as well as from the. Do you so if you still have any kind of confusing even asking the common books and here are the last we have into question so in this video I will ask the questions first one is why I don't make the don't make the.

 View view with the,nd line because of that I just made the controller to make it to the,nd line but wide V. are not make the view with the,nd line and and the second question is so let's see I'm just going to put in my phone call order a mis spell your name then you can see that being caught added here. So can we just check that the view is a available or north you know what accord before just calling it right so is it possible if yes then how if not then why and that's all for a moment bye bye take care and please don't forget to subscribe my channel and like this video bye bye.

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.