Support the ongoing development of Laravel.io →
posted 10 years ago
Requests Input
Last updated 2 years ago.
0

Try this:

Route::get('find', function()
{
    //display search page
});

Route::get('find/{name}', function($name)
{
    //display search results for {name}
});

or this:

Route::get('find/{name?}', function($name = null)
{
    //logic to display search form or search results
});

read more here: http://laravel.com/docs/routing#route-parameters

Last updated 2 years ago.
0

I use controllers Let me show you

Route::get('find/{name}', 'SearchController@search');

or can be also post

Route::post('find/{name}', 'SearchController@search');

and into controller i pass the route parameter name into the view composer

public function search($name)
{
	View::composer('search', function($view)
	{
		$viewdata= $view->getData();
		$name=$viewdata['name'];
                    //query here and $view->with to parse to the template
	});
	return View::make('search')->with('name',$name);
}
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Joe96 joe96 Joined 28 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.