I'm trying to understand how to pass parameters via URL in Laravel.
In my case I've a home page (/) (HomeController@get__home and view home) that contains n data get from a database table. The user can select one of them and go to the next page.
The second url page is /{param from first page}/login
The field {param from first page} comes from (of course) first page and depends on which record was selected.
I've read this, but I think I'm out of the way.
I can not find a way to pass the parameter to the url.
In my Route.php:
Route::get("/", "HomeController@home");
Route::get("/{position}/login", "LoginController@login");
and in Controllers:
class HomeController extends Controller
{
public function home(){
$foos = Foo::all();
return view('home')->with('foos',$foos);
}
}
class LoginController extends Controller
{
public function login(Foo $foo)
{
return view('login');
}
}
and in home.blade.php
<form class="" action="" method="post">
...
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire