Laravel Classroom image

Prashant  Nigam / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9|Last
Lessons:-Using Controllers

3.2 Passing Parameters
This simple routing is interesting, but it doesn’t offer us anything that a simple PHP website
could not.
Let’s try something a little more dynamic. By adding parameters to our controller actions we
can pass extra data as segments to the URL. Let’s add a welcome action to our controller :
1 <?php
2
3 // application/controllers/account
4 public function action_welcome($name, $place)
5 {
6 echo "Welcome to {$place}, {$name}!";
7 }
Here our action parameters are method parameters, so the above code should seem familiar.
Let’s try visiting the route /account/welcome/Dayle/Wales..
1 Welcome to Wales, Dayle!
Parameters can be used to pass resource identifiers to enable CRUD actions on data, or anything
you can think of! As you can see, they offer a great deal of flexibility to our actions.
Note : You can assign values to your action parameters to make them optional in the URL.

 
 
 

Prashant  Nigam

Skills    Laravel

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)