Tuesday, February 28, 2017

Laravel API patch method

I am developing a laravel api and sucessfully made gets, posts, deletes and i am now trying to do the update method using PATCH.

Here is my first try:

public function update($id, Request $request)
{
    $taxes = taxes::find($id);
    $taxes ->fill($request->only(['$request']));
    $taxes->save();
}

And testing it with the follow url on postman

****.local/api/taxes/1?description=test

This obviously doesnt work, i tought i would be able to see the error but i am currently on a different machine but hopefully someone can guide me to correct path to make this update method.

Dont forget its an api, no views/forms.

Thank you.




via Cyanogen

Advertisement