A small problem occurred while using laravel5.2. I have defined a resource route and saved the resource route name to the database. now, after searching and deleting the database, the following result is displayed: {code ...} next, in the template, I put the above array... A small problem occurred while using laravel5.2.
I have defined a resource route and saved the resource route name to the database. now, after searching and deleting the database, the following results are obtained:
array (size=6) 0 => object(stdClass)[221] public 'id' => int 10 public 'route' => string 'menu.create' (length=11) 1 => object(stdClass)[222] public 'id' => int 11 public 'route' => string 'menu.index ' (length=11)
Next, in the template, I output all the URLs corresponding to all the routing names in the preceding array.
@foreach($menulist as $menu) {{ route($menu->route) }} @endforeach
But an error occurs:
ErrorException in UrlGenerator. php line 314:
Route [menu. index] not defined.
If you simply use {route ('menu. index')}, no error occurs. Where is the problem?
Reply content:
A small problem occurred while using laravel5.2.
I have defined a resource route and saved the resource route name to the database. now, after searching and deleting the database, the following results are obtained:
array (size=6) 0 => object(stdClass)[221] public 'id' => int 10 public 'route' => string 'menu.create' (length=11) 1 => object(stdClass)[222] public 'id' => int 11 public 'route' => string 'menu.index ' (length=11)
Next, in the template, I output all the URLs corresponding to all the routing names in the preceding array.
@foreach($menulist as $menu) {{ route($menu->route) }} @endforeach
But an error occurs:
ErrorException in UrlGenerator. php line 314:
Route [menu. index] not defined.
If you simply use {route ('menu. index')}, no error occurs. Where is the problem?
What you read from the database at this time is only the object string, not an object. you need to convert it into an object before you can execute