How To Pass GET Parameters To Laravel From With GET Method ?

后端 未结 7 897
余生分开走
余生分开走 2020-11-30 02:05

i\'m stuck at this very basic form, that i could not accomplish, which i want to build a search form with an text input, and two select controls, with a route that accept 3

7条回答
  •  醉梦人生
    2020-11-30 02:32

    An alternative to msturdy's solution is using the request helper method available to you.

    This works in exactly the same way, without the need to import the Input namespace use Illuminate\Support\Facades\Input at the top of your controller.

    For example:

    class SearchController extends BaseController {
    
        public function search()
        {
            $category = request('category', 'default');
            $term = request('term'); // no default defined
    
            ...
        }
    }
    

提交回复
热议问题