-1

I'm trying to Update row on my db
I have been told that I need to create PUT route for this
So I did:

 Route::put('update/{id}/{done}', 'TasksController@update');

My Controller:

class TasksController extends Controller {

public function index(){
    DB::statement("SET NAMES 'utf8'");
    $todolist = DB::select('select * from todo');
    return $todolist;
}

public function update($id, $done){
    DB::update('update todo set done = ? where id = ?',[$done,$id]);
}
}

And I get this Error on java script console when I try to get update/1/1 with ajax:

 (index):110 PUT http://localhost:8080/ex/ex/public/update/1/1 500 (Internal Server Error)

when I get to page from broswer I get:

 MethodNotAllowedHttpException in RouteCollection.php line 218:

And a list of files, What is the error and how can I fix it?

Harman met
  • 241
  • 2
  • 3
  • 10

1 Answers1

-1

here some advices : 1. to update use patch not put 2. make sure to add _token to your form 3. in your form add 'method' => 'PATCH'

issam abbas
  • 347
  • 2
  • 9