I am new to laravel and I am trying to load the header, footer and view file from the controller into a common template and display the data from the controller in a view file. But I get an errorView ['admin.dashboard'] not found.
Toolbar file is present in admin folder inside views
controller
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'));
}
}
common_template.blade View
<?php echo View::make('includes/header'); ?>
<?php echo $template = "'".$data['template']."'";
echo View::make($template); ?>
<?php echo View::make('includes/footer'); ?>
When I add "admin / dashboard" instead of $data['template']directly to $template, it loads the dashboard file, whereas it does not load when I pass it as a string from the controller.
dashboard.blade view
<p><?php echo $data['title']; ?></p>
Please help me get through this. Thanks
source
share