public function deleteArea(Request $request, $id) { $propertyCount = Property::where('subdistrict', $id)->count(); if ($propertyCount > 0) { return redirect()->back()->withErrors(['Area can\'t be deleted because it is used by Property.']); } $qb = DB::table('rajaongkir_indonesia_subdistricts')->where('subdistrict_id', $id)->delete(); return redirect()->back()->with('messages', ['Area has been deleted.']); }
public function getViewExternal(Request $request, $for, $location, $property) { $propertyListingCode = last(explode('-', $property)); if (strpos($propertyListingCode, 'go') === false) { $propertyObj = Property::find($propertyListingCode); } else { $propertyObj = Property::where('listing_code', $propertyListingCode)->first(); } return $this->getView($request, $propertyObj, true); }