Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hii,
I am using laravel.
I want to call more then one view like head,main,foot in same function using laravel.

What I have tried:

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class Sendmail extends Controller
{
    public function index()
    {
        // @yield('head');
        return  View('head') ;
        return  View('services') ;
        return  View('footer') ;

       
        // return view::make('head')->with('services');

    }
}
Posted
Updated 26-Dec-19 2:11am
v3

You cannot have multiple return statements in a method like that. The first one that is encountered will always be executed, and the other two will always be ignored. You need some sort of decision making to decide which view to return based on an input parameter, or other defined value.
 
Share this answer
 
Hi Please refer this link to get the solution.
Laravel Load multiple views in same controller | Nested[^]
Thank you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900