hala
hala

Reputation: 161

How to delete all content in laravel project?

I want to delete all content from the table in database using a delete method with an url:

Route::post('delete','receiptcontroller');

But I got an error Invalid route action:

[App\Http\Controllers\receiptcontroller]

The view:

<form action="{{ url('delete') }}">
    <input type="submit" value="delete" class="btn-danger btn-lg">
</form>

and method:

public function delete() {
    receipt::truncate();
} 

Upvotes: 0

Views: 257

Answers (1)

Canor
Canor

Reputation: 919

Try this:

Route::post('/delete','receiptcontroller@delete');

Upvotes: 1

Related Questions