Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] RESTFul routes with resource not found

(This post was last modified: 08-03-2023, 04:53 AM by superior.)


I'm currently creating a new RESTfull endpoint for relations, but something seems to be going wrong and i've got no idea if this is something on my end.

Package information
  1. CodeIgniter4 (latest)
  2. Shield (latest)
  3. DayCry Cronjob (latest)

Using the following from the documentation: https://codeigniter4.github.io/userguide...oller-used

But on the endpoint the following error occurres, and i'm 1000% shure the file is there.
Manually this is no problem, but this requires each endpoint to be set in the routes.

Error: "message": "Controller or its method is not found: \\App\\Outhands\\Relations\\Controllers\\API\\RelationResource::new",

Partial code:
PHP Code:
$routes->group('api/v1', ['filter' => 'tokens'], function($routes) {
    // Relations
    $routes->resource('relations', ['controller' => 'App\Outhands\Relations\Controllers\API\RelationResource''placeholder' => '(:num)']);
    // $routes->get('relations', [RelationResource::class, 'index']);
    // $routes->get('relations/new', [RelationResource::class, 'new']);
    // $routes->get('relations/(:num)', [[RelationResource::class, 'show'], '$1']);
    // $routes->get('relations/(:num)/edit', [[RelationResource::class, 'edit'], '$1']);
    // $routes->post('relations', [RelationResource::class, 'create']);
    // $routes->put('relations/(:num)', [[RelationResource::class, 'update'], '$1']);
    // $routes->delete('relations/(:num)', [[RelationResource::class, 'delete'], '$1']);

[Image: pfTepPXrjSxZ2hF_1690970040.png]

Did i misunderstood the documentation or does this seem to be a bug in CI4?

Apparently i've misspelled the controller, my issue has been resolved.

Messages In This Thread
[SOLVED] RESTFul routes with resource not found - by superior - 08-02-2023, 02:43 AM

Theme © iAndrew 2016 - Forum software by © MyBB