N
N
Narek Poghosyan2018-01-31 02:16:43
Laravel
Narek Poghosyan, 2018-01-31 02:16:43

What have I done wrong?

//routes/web.php
Route::match(['get', 'post', 'delete'], '/edit/{page}',['uses' => '[email protected]', 'as' => 'pagesEdit'] );

//blade.php
{!! Form::open([url(route('pagesEdit', ['page' => $page->id])), 'class' => 'form-horizontal', 'method' => 'POST']) !!}
{{ method_field('DELETE') }}
{!! Form::button('Delete', ['class' => 'btn btn-danger', 'type' => 'submit']) !!}
{!! Form::close() !!}
//Controller.php
       if ($request->isMethod('delete')){

            $page->delete();

            return redirect('admin')->with('status', 'Page Deleted');
        }

When deleting a page, the following error appears:
5a70fcce5b494847185878.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Antonio Solo, 2018-01-31
@solotony

and what is written in the route?
reaches the controller?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question