cloudcreativity / laravel-json-api

JSON API (jsonapi.org) package for Laravel applications.
http://laravel-json-api.readthedocs.io/en/latest/
Apache License 2.0
780 stars 109 forks source link

Class [App\JsonApi\Locationreports\Adapter] is not a resource adapter #437

Closed cunhar closed 5 years ago

cunhar commented 5 years ago

createAdapterFromClassName seems to be only upper casing the resource name's first letter.

Am I doing something wrong when having Resources that have Two uppercase letters

IE: Locationreports vs LocationReports

json-api-default 'locationreports' => \App\LocationReport::class

ROUTES: $api->resource('locationreports')->relationships(function ($relations) { $relations->hasOne('lapa'); $relations->hasOne('installation'); });

ADAPTER: namespace App\JsonApi\LocationReports;

SCHEMA: protected $resourceType = 'locationreports';

lindyhopchris commented 5 years ago

So it works out the namespace based on the JSON API resource name. As you've used locationreports that equals Locationreports because you haven't put a - or _ in the name, i.e. location-reports or location_reports depending on your API's convention.