Solution:
You can include many views inside a single view using the @include
directive:
combined.blade.php
:
@include('contatos.index')
@include('auth.register')
Then in your controller:
public function index()
{
$users = User::orderBy('name', 'asc')->paginate(13);
$users2 = User::all();
return view('combined')->with('users', $users);
}
There are many variants of include
, like includeWhen
of includeIf
, they are all described in the documentation: https://laravel.com/docs/8.x/blade#including-subviews
However, the key point to understand is that you always return only one thing (in your case, one view).
This view can be composed of multiple parts and this compositing job is the role of Blade.