““class”: “ForestAdmin\LaravelForestAdmin\Exceptions\ForestException”,
“message”: “ Unknown field tiers.name for this collection”,
“code”: 0,
“file”: “[…]vendor/forestadmin/laravel-forestadmin/src/Services/Concerns/HasFilters.php:376”,”
When querying, or viewing the ‘tiers’ table, throws an error. The database does have a tiers.name and is used by our API and platform via Laravel.
Expected behavior
Shows data or uses field in query
Failure Logs
““class”: “ForestAdmin\LaravelForestAdmin\Exceptions\ForestException”,
“message”: “ Unknown field tiers.name for this collection”,
“code”: 0,
“file”: “[…]vendor/forestadmin/laravel-forestadmin/src/Services/Concerns/HasFilters.php:376”,”
The model still isn’t part of the schema. This seems to have changed in the last couple of updates since 1.2.0, we used to be able to at least navigate via the “Tier” relationship, if not query against it. Now as of 1.2.2 the relationships are blank in forestadmin.
I’ve had a look on our end and the Tier model as you say isn’t in the schema locally either in the json. This may be because of a couple of things:
The Tier class isn’t in the root Model folder, it’s in App/Tiers/Tier.php rather than App/Models/Tier/Tier/php alongside the other models.
The underlying table is “Tiers” but the class is called “Tier”. The model has protected $table = “tiers” on the model though.
We can potentially solve this on our end by manually updating the schema - but imagine this will just get overwritten everytime we serve the app, and won’t work on production.
I have just looked at the schema history on the development environment.
Previously until 2022-11-01 19:36:13 the schema had the model Tier (with namespace App/Models).
But since 2022-11-01 20:04:31 the model is no longer present in the schema.
I have a very simple solution to fix this problem
Just edit the config/forest.php file and change the 1st line like this:
That seems to have resolved it, although it’s not showing in the collections list (which doesn’t really matter for us, it’s more of just a reference table). Thanks for the help.