Feature(s) impacted
Listing of Collection in left menu
Observed behavior
A collection does not show in the left menu after clicking “Edit Layout”. It’s also not present at all in the forestadmin_schema.json, even though it is referenced from other collections in the schema.
Expected behavior
The collection should appear in the forest schema.
Failure Logs
Context
Model below:
<?php
namespace App\FavouritesLists;
use App\Models\User;
use App\Models\Artist;
use App\Models\ActivityLog;
use Illuminate\Database\Eloquent\Model;
use App\FavouritesLists\Favourites\Favourite;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use ForestAdmin\LaravelForestAdmin\Services\Concerns\ForestCollection;
class FavouritesList extends Model
{
use HasFactory, ForestCollection;
protected $table = 'favourites_lists';
protected $fillable = [
'name'
];
public function favourites(): HasMany
{
return $this->hasMany(Favourite::class);
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function artists(): HasManyThrough
{
return $this->hasManyThrough(Artist::class, Favourite::class, 'favourites_list_id', 'id', null, 'artist_id');
}
public function activityLogs()
{
return $this->morphMany(ActivityLog::class, 'activity_loggable');
}
}
- Project name: …
- Team name: …
- Environment name: …
- Agent (forest package) name & version: PHP Laravel 1.2.3
- Database type: …
- Recent changes made on your end if any: …