Skip to content

Authorizers should receive multiple PHP types for polymorphic entities #362

@fisharebest

Description

@fisharebest

Not sure if this is a bug, or if we're doing something wrong.

In our config/json-api-default.php, we have a "polymorphic type" roles:

    'resources'     => [
        'users' => App\User::class,
        'roles' => [App\Role::class, Spatie\Permission\Models\Role::class],
    ],

Now, the function Routing\Route::getType() type-hints a string return type:

https://github.com/cloudcreativity/laravel-json-api/blob/v1.1.0/src/Routing/Route.php#L146

However, the return value comes from the config file, and is an array.

This throws a fatal PHP error.

/edit - FYI we found this when upgrading from 1.0.0-beta.5 to 1.1.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions