I am building a ebsite with Laravel 5.5.
I have a resource controller named DouGroupController
.
In my routing web.php
I tried to do the following:
Route::resource('/dogroups', 'DoGroupController');
When I go to http://localhost:8000/dogroups
I get a list of all my dogroups, but when I go to http://localhost:8000/dogroups/1
, Laravel can't seem to find my dogroup. I am certain that there is a dogroup with id 1. It also doesn't give an error for id's which do not exist.
When I do Route::get('/dogroups/{dogroup}', 'DoGroupController@show');
it does work.
This is my show
function of DoGroupController
:
public function show(DoGroup $doGroup)
{
return view('dogroups.show', ['dogroup' => $doGroup]);
}
and my dogroups.show
view, which extends the standard laravel layout which is generated when you run php artisan make:auth
@extends('layouts.app')
@section('content')
<div class="container">
<h1></h1>
</div>
@endsection
Why doesn't Route::resource('/dogroups', 'DoGroupController');
work? And how do i fix it?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire