M
M
Mokhirjon Naimov2015-04-20 17:39:06
HTML
Mokhirjon Naimov, 2015-04-20 17:39:06

Is it possible to make a DELETE (Route::delete()) request for an a (html) tag in Laravel?

Used by Laravel!
Typically, CRUD applications have three buttons (button links) show, edit, and delete. Forming the first two buttons is easy (because they have a GET request), but the third is not smooth.
For thirds, I create a form with a DELETE method, but is it possible to form a DELETE request for the tag ? Now I use:<a>

{{ Form::open(array('route' => array('admin.some.thing', $item->id), 'method' => 'DELETE') }}
    <button type="submit" class="btn btn-danger">
        <span class="glyphicon glyphicon-remove"></span>
    </button>
{{ Form::close() }}

Should be replaced with something like this:
<a href="{{ route('admin.some.thing', $item->id) }}" class="btn btn-danger">
    <span class="glyphicon glyphicon-remove"></span>
</a>

PS: Resource controller is used! It is important.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2015-04-20
@zvermafia

Links cannot be with the DELETE method. Option one is to use ujs or something similar.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question