You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Defining routes with parameter | ---
| Bug? | no
| New Feature? | no
| Framework | Laravel
| Framework version | 8.54
| Package version | 3.0.0
| PHP version | 7.4.22
Actual Behaviour
Hey everyone, I am new to Dingo API and following documentation but I am struggling with creating routes with parameters. When I send a request to localhost/users it works as expected and response me all users in database. But when I try to send a request to show a specific user via id parameter, it returns 500 error with following message, also if I run a php artisan command it gives me the same error:
Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameter for [Route: users.show] [URI: api/users/{id}] [Missing parameter: id].
class UserController extends Controller
{
public function index()
{
return User::all();
}
public function show($id)
{
return User::where("id",$id)->first();
}
}
How can I fix this? Thanks in advance.
The text was updated successfully, but these errors were encountered:
| Defining routes with parameter | ---
| Bug? | no
| New Feature? | no
| Framework | Laravel
| Framework version | 8.54
| Package version | 3.0.0
| PHP version | 7.4.22
Actual Behaviour
Hey everyone, I am new to Dingo API and following documentation but I am struggling with creating routes with parameters. When I send a request to localhost/users it works as expected and response me all users in database. But when I try to send a request to show a specific user via id parameter, it returns 500 error with following message, also if I run a php artisan command it gives me the same error:
Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameter for [Route: users.show] [URI: api/users/{id}] [Missing parameter: id].
Steps to Reproduce
api routes:
User Controller
How can I fix this? Thanks in advance.
The text was updated successfully, but these errors were encountered: