So everything was working perfectly in version 5.1 of my laravel project but after upgrading to 5.2 every page with any kind of controller logic loads blank. Not even the header or footer will load. The only pages that are loading correctly are the static html pages that do not have any kind of code in the controller for example,
public static function viewHowItWorksAction()
{
return view("pages/howitworks");
}
This will load fine with all of the correct css. However if I try to load another view that has some code in the controller the page will load blank. I just see a white screen. It is hard to troubleshoot because there are no errors or any indication of what may be wrong. Has anyone experienced this and can you tell me how to fix this problem? An example of a controller that never loads the view is below.
<?php namespace App\Http\Controllers;
use App\Models\Review;
use App\Models\Service;
use App\Models\Event;
use App\Models\Features;
use App\Models\PageContent;
use Illuminate\Support\Facades\Auth;
class HomeController extends Controller
{
public function viewHomeAction()
{
$reviews = Review::orderBy('updated_at', 'desc')->take(9)->get();
$services = Service::orderBy('avgreview', 'desc')->where("services.is_temp", 0)->take(4)->get();
$events = Event::where("events.is_temp", 0)->orderBy('avgreview', 'desc')->take(4)->get();
$new_events_id = array();
$my_featured_listings_events = Features::where('type', 'event')
->orderBy('finish', 'asc')
->get()
->lists('item_id');
foreach ($my_featured_listings_events as $id) {
$event = Event::where('id', '=', $id)
->first();
if ($event->getFeatureStatus()) {
$new_events_id[] = $id;
}
}
if (count($new_events_id) > 0) {
$featured_events = Event::whereIn('id', array_slice($new_events_id, 0, 3))
->where("events.is_temp", 0)
->get();
} else {
$featured_events = null;
}
$new_services_id = array();
$my_featured_listings_services = Features::where('type', 'service')
->orderBy('finish', 'asc')
->get()
->lists('item_id');
foreach ($my_featured_listings_services as $id) {
$service = Service::where('id', '=', $id)
->first();
if ($service->getFeatureStatus()) {
$new_services_id[] = $id;
}
}
if (count($new_services_id) > 0) {
$featured_services = Service::whereIn('id', array_slice($new_services_id, 0, 3))
->where("services.is_temp", 0)
->get();
} else {
$featured_services = null;
}
//Get Content
$widget1 = PageContent::find(1);
$widget2 = PageContent::find(2);
$widget3 = PageContent::find(3);
return view("pages/home")
->with("reviews", $reviews)
->with("services", $services)
->with("events", $events)
->with("featured_events", $featured_events)
->with("featured_services", $featured_services)
->with("widget1", $widget1)
->with("widget2", $widget2)
->with("widget3", $widget3);
}
}
Any help or guidance is greatly appreciated.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community