Monday, April 3, 2017

Laravel, cannot delete database row

So, i have a single page for every database row on my website. When i look at this single page i have created a button to delete the specific row from the database. For this case, it's id 17.

I'm using Laravel 5.4

How do i do this? i get this error: NotFoundHttpException in RouteCollection.php line 161:

My routes:

Route::get('/deleteSite{id}', 'ScanController@delete');

Controller:

public function delete($id) {

        $scan = Scan::find($id);
        $scan->delete();

        return redirect('home');

    }

My url: http://seo.website.nl/deleteSite/17?(17 is the id that i want to delete, why is the questionmark here?)

Button:

 <form method="GET" action="/deleteSite/"><button type="submit" class="btn btn-danger">Delete</button></form>

Thanks in advance.



via itvba

Advertisement