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
When two resources use one model, the resource mapping only references the last one sorted alphabetically.
app/Models/UserModel.php:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UserModel extends Model {}
app/Nova/UserOne.php:
<?php
namespace App\Nova;
use Laravel\Nova\Http\Requests\NovaRequest;
class UserOne extends Resource {
public static $model = \App\Models\UserModel::class;
public function fields(NovaRequest $request): array
{
return [];
}
}
app/Nova/UserTwo.php:
<?php
namespace App\Nova;
use Laravel\Nova\Http\Requests\NovaRequest;
class UserTwo extends Resource {
public static $model = \App\Models\UserModel::class;
public function fields(NovaRequest $request): array
{
return [];
}
}
For the purposes of this test only, change the visibility of \Parental\Providers\NovaResourceProvider::setNovaResources() to public:
When two resources use one model, the resource mapping only references the last one sorted alphabetically.
app/Models/UserModel.php
:app/Nova/UserOne.php
:app/Nova/UserTwo.php
:For the purposes of this test only, change the visibility of
\Parental\Providers\NovaResourceProvider::setNovaResources()
to public:Tinker session without
NovaResourceProvider
:Tinker session with
NovaResourceProvider
:As you can see from the above example, when
NovaResourceProvider
is booted, it changes the resource mapping, resulting in unexpected behavior.The text was updated successfully, but these errors were encountered: