src/Services/TranslatorService.php
public function getClassFromResource($resource)
    {
        // This is the models namespace
        $modelsNamespace = Config::get('api.models_namespace', Config::get('api.app_namespace'));

        // This array contains mapping between resources and Model classes
        $mapping = Config::get('api.mapping');

        if (!is_array($mapping)) {
            throw new RuntimeException('The config api.mapping needs to be an array.');
        }

        if (!isset($mapping[$resource])) {
            throw new NotFoundHttpException;
        }

        return implode('\\', [$modelsNamespace, $mapping[$resource]]);
    }
public function getClassFromResource($resource)
    {
        // This is the models namespace
        $modelsNamespace = Config::get('api.models_namespace', Config::get('api.app_namespace'));

        // This array contains mapping between resources and Model classes
        $mapping = Config::get('api.mapping');

        if (!is_array($mapping)) {
            throw new RuntimeException('The config api.mapping needs to be an array.');
        }

        if (!isset($mapping[$resource])) {
            throw new NotFoundHttpException;
        }

        return implode('\\', [$modelsNamespace, $mapping[$resource]]);
    }
Returns a class name base on a resource mapping.
The mapping comes from a config file (api.php).

Example: `users` should return `\App\Models\User`

@param string $resource
@return string
@throws NotFoundHttpException