I'm having the following resource route:
Route::resource('/evenementen', 'EventController');
According to the following command(php artisan route:list):
POST | admin/evenementen | evenementen.store | App\Http\Controllers\EventController@store | web,App\Http\Middleware\isAdmin |
GET|HEAD | admin/evenementen | evenementen.index | App\Http\Controllers\EventController@index | web,App\Http\Middleware\isAdmin |
GET|HEAD | admin/evenementen/create | evenementen.create | App\Http\Controllers\EventController@create | web,App\Http\Middleware\isAdmin |
GET|HEAD | admin/evenementen/{evenementen} | evenementen.show | App\Http\Controllers\EventController@show | web,App\Http\Middleware\isAdmin |
DELETE | admin/evenementen/{evenementen} | evenementen.destroy | App\Http\Controllers\EventController@destroy | web,App\Http\Middleware\isAdmin |
PUT|PATCH | admin/evenementen/{evenementen} | evenementen.update | App\Http\Controllers\EventController@update | web,App\Http\Middleware\isAdmin |
GET|HEAD | admin/evenementen/{evenementen}/edit | evenementen.edit | App\Http\Controllers\EventController@edit | web,App\Http\Middleware\isAdmin
I should have those routes. The store, index and create routes and methods are working. The rest of the routes are not.
If I got to /admin/evenementen/1/edit it gives me a "Page not found" error. This also happens if POST to /admin/evenementen/1 with the following form:
<form id="frm-delete" action="{{ URL::asset('admin/evenementen/'.$event->id) }}" method="POST">
{{ csrf_field() }}
@method('DELETE')
<button type="submit" class="dropdown-item">
Verwijderen
</button>
</form>
In the EventController I have the following methods that should correspond with the routes:
public function index() {..}
public function destroy($id) {..}
public function show($id) {..}
public function create() {..}
public function store(CreateEventRequest $request) {..}
public function edit($id) {..}
Have been googling a lot and can't find what I am doing wrong. Really hope someone can help me out.
admin/evenementen
while your form is callingadmin/evenement
. – Magnus Eriksson