Collection not generated in forest schema

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


Model below:


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 = [

    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: …

Hi @EFGP :wave:,

By default, the agent fetches the models into the directory app\Models.

You can add other directories in addition to app\Models in the forest.php config.

Here is the link to the documentation for customize models directories structure: Laravel specific settings - Developer guide

1 Like