title: Laravel - Load common header and footer to view
body: <p>I am new to Laravel and I am trying to load header, footer and the view file from controller in a common template and display the data from controller in the view file. But I get error</p>
  <blockquote>
  <p>View ['admin.dashboard'] not found.</p>
  </blockquote>
  <p>The dashboard file is present in the admin folder inside views.</p>
  <h3>Controller</h3>
  <pre><code>namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  
  use App\Http\Requests;
  use App\Http\Controllers\Controller;
  
  class common extends Controller
  {
  
     public function login()
     {
          $data['title'] = 'Dashboard';
          $data['template'] = 'admin/dashboard';
          return view('common_template', compact('data'));
  
     }
  }
  </code></pre>
  <h3>common_template.blade View</h3>
  <pre><code>&lt;?php echo View::make('includes/header'); ?&gt;
  
  &lt;?php echo $template = &quot;'&quot;.$data['template'].&quot;'&quot;;
  echo View::make($template); ?&gt;
  &lt;?php echo View::make('includes/footer'); ?&gt;
  </code></pre>
  <p>When I add 'admin/dashboard' instead of <code>$data['template']</code> directly in <code>$template</code>, it loads the dashboard file whereas it doesn’t load when i pass it as string from controller.</p>
  <h3>dashboard.blade view</h3>
  <pre><code>&lt;p&gt;&lt;?php echo $data['title']; ?&gt;&lt;/p&gt; // Printing the data from the controller
  </code></pre>