I have a controller in Laravel 5.
I would like to write a controller function that accepts variable arguments.
For example,
public function show(Request $request, ...$id)
{
// handle multiple $id values here
}
The reason is that I have a url structure that has 'nested' models. For instance:
\item\{$id}
\parent\{$parent_id}\item\{$id}
\grandparent\{$grandparent_id}\parent\{$parent_id}\item\{$id}
My desire is to write a single show() method. Because of the structure of my database, it is possible. But the UrlGenerator keeps throwing a UrlGenerationException when I try to use variable arguments. It seems like it doesn't understand this construct?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ku67iu
via IFTTT
Aucun commentaire:
Enregistrer un commentaire