I have these view files:
about.blade.php
home.blade.php
contact.blade.php
I want to return all of them using one controller function index()
:
public function index()
{
return view(['about', 'contact', 'home']);
}
I have these view files:
about.blade.php
home.blade.php
contact.blade.php
I want to return all of them using one controller function index()
:
public function index()
{
return view(['about', 'contact', 'home']);
}
2
Answers
you can use the
view()->first()
method to return the first view file that exists in the specified array of views.for example:
You can use route params for it.
Define route in web.php:
Then in the controller use this: