I'm trying to include a view on all of my pages (code is below), so I've included it within my layout template (so it renders on everything). Unfortunately, when I try and run any page - this error occurs:
Undefined variable: sites (View: /Users/Documents/audit/resources/views/layouts/check.blade.php)
View (check.blade.php):
@if (count($sites) == 0)
// Removed as it is irrelevant.
@endif
Controller:
public function siteCheck()
{
return View::make('layouts.check')
->with('sites', Site::where('user_id', Auth::id())
->get());
}
Where I try and include the view (which shows the error):
@if(!Auth::guest())
@include('layouts.check')
@endif
N.B. I haven't added any code relating to the layouts.check page within the routes.
Many thanks for your help.