mercredi 5 février 2020

Object of class App\city_cost could not be converted to int

I am using laravel helpers function. I am passing an argument to it that contains a value which I want to use to update the user table a field cold totcosty. But Everytime it is showing me this error. This is the helper function

 Class Helper{
 public static function cost($citycos)
{

           $user = new User();

            $user->totcosty  += $citycos;
            $user->update();
}

}

This is where I passed the value

public function store(Storecit $request)
{
$citycos->cost=$request->input('city_cost');
    $citycos->save();
    $test = Helper::cost($citycos);

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire