K5AD
7 months ago
243
6
Laravel

Call to undefined method Illuminate\Database\Query\Builder::save()

Posted 7 months ago by K5AD

public function update(Request $request, $id) {

    $prop = DB::table('properties')->where('id',$id);

    $prop->propType_id = $request->propType;
    $prop->propFor = $request->propFor;  
    $prop->propDistrict = $request->district;
    $prop->propLocation = $request->location; 
    $prop->propSize = $request->size; 
    $prop->suitableFor = $request->suitable; 
    $prop->waterP = $request->watPrice; 
    $prop->electricP = $request->electricP; 
    $prop->totPrice = $request->propPrice; 
    $prop->description = $request->description; 

    $prop->save();
   
    $faci = DB::table('facilities')->where('propID',$id)->get();        

    $faci->bikeP = $request->bikeP;
    $faci->carP = $request->carP;
    $faci->waterB = $request->waterB;
    $faci->waterD = $request->waterD;
    $faci->propID = $id;

    $faci->save();

 
    return redirect()->back()->with('success', 'Property Updated successfully');
}

Error arise when I try to update second table also

Please sign in or create an account to participate in this conversation.