Skip to content
Advertisement

Tag: controller

Laravel: how to pass GET array to controller?

How to pass array of GET parameters to the controller? This is my route file routes/web.php: And my controller ‘app/Http/Controllers/Parser.php’: So, I expect to get an array of parameters like this: But if I pass GET array to my route path: http://example.com/ids?ids[]=1&ids[]=2&ids[]=15&ids[]=25 I get an empty request object anyway: {“attributes”:{},”request”:{},”query”:{},”server”:{},”files”:{},”cookies”:{},”headers”:{}} Answer There is few ways to get data from GET.

Undefined database variable

Blog.php code below: blog_index.php code below: I can’t see where is my mistake, it raises a errorException: “Undefined Variable:dados”. About $categorias variable, am learning how to use more than one table per controller. Codeigniter version: 4.0.4 Running through xampp Answer Controller Blog.php View blog_index.php Note :- For Reference see this:- https://codeigniter4.github.io/userguide/outgoing/views.html#adding-dynamic-data-to-the-view

Advertisement