public function main($property_id) { if (is_null(Property::find($property_id))) { return Redirect::to('admin/properties')->with('error', 'Property was not found.'); } Session::put('redirect_url', URL::current()); $monitorings = Monitoring::orderBy('block', 'desc')->where('property_id', $property_id)->get(); $total_available = Monitoring::orderBy('block', 'desc')->where('status', true)->where('property_id', $property_id)->count(); $total_unavailable = Monitoring::orderBy('block', 'desc')->where('status', false)->where('property_id', $property_id)->count(); $property = Property::find($property_id); return View::make('admin.monitorings.main', compact('monitorings', 'property', 'total_unavailable', 'total_available')); }