how to update first row on button click

  eloquent, jquery, laravel, php, updates

i want to update a first record status into ‘2’ based on button click.
Here is my code :

     public function repay(Request $request,$loanid){

    $obj = DB::table('schdls')
    ->where('schdls.loanid','=',$loanid)
    ->where('schdls.status','=',1)->first();
   
   
        $obj->status='2';
        $obj->save();
   
    return redirect('/home')->with('message','updated');
      }

But it says Call to undefined method stdClass::save() error,

What am i missing?

Source: Ask PHP

LEAVE A COMMENT