# Collection named geopardized (Laravel package)

**URL:** <https://community.forestadmin.com/t/collection-named-geopardized-laravel-package/4891>\
**Category:** Help me!\
**Tags:** setup\
**Created:** [June 23, 2022, 1:04pm UTC](https://community.forestadmin.com/t/collection-named-geopardized-laravel-package/4891 "2022-06-23T13:04:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![storm23](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/storm23/32/4686_2.png) [@storm23](https://community.forestadmin.com/u/storm23)\
**Post date:** [June 23, 2022, 1:04pm UTC](https://community.forestadmin.com/t/collection-named-geopardized-laravel-package/4891/1 "2022-06-23T13:04:07Z")

</div>

## Feature(s) impacted

Collection name

## Observed behavior

I have several weird collections name :

- a table named “analytics\_basket” \> Collection name : “Baskets” (but I have also a “basket” table which I can’t see in collections)
- a table named “order\_counter\_offer” \> Collection name : “Counter offers” : why “Order” disappeared ? I have also a table named “order\_delivery” \> Collection name “Order Deliveries” : name is OK

## Expected behavior

- table name “analytics\_basket” \> Collection name “Analytics Baskets”
- table name “order\_counter\_offer” \> Collection name “Order Counter Offers”

More generally, I don’t understand why, in “COLLECTION SETTINGS”, in the field “name” it’s already a modified name. Like “counterOffer” for my table “order\_counter\_offer”. Why not the exact table name since there is “Display name” field ?

## Failure Logs

N/A

## Context

MySQL Database : 8.0.22  
Laravel Forest Admin package : 1.0.1

---

<div class="post-metadata">

**Author:** ![anon21153075](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@anon21153075](https://community.forestadmin.com/u/anon21153075)\
**Post date:** [June 23, 2022, 2:42pm UTC](https://community.forestadmin.com/t/collection-named-geopardized-laravel-package/4891/3 "2022-06-23T14:42:53Z")

</div>

Hi @storm23,

I’m not sure about your issue.

When you said table named “analytics\_basket” is there a Model that reference this table ? If yes what is the name of this model class ?

The Forest agent lists only the laravel models not all your database tables.

Also could you share your project Id and the environment name.

---

<div class="post-metadata">

**Author:** ![storm23](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/storm23/32/4686_2.png) [@storm23](https://community.forestadmin.com/u/storm23)\
**Post date:** [June 23, 2022, 2:47pm UTC](https://community.forestadmin.com/t/collection-named-geopardized-laravel-package/4891/4 "2022-06-23T14:47:40Z")

</div>

Ok I got it ! The name is bases on the Model name, not the mapped table ? Right ?

It’ a problem for me because I have several namespaces in my Models. For example :

- MyApp\Models\Analytics\Basket =\> “analytics\_basket” table
- MyApp\Models\Customer\Basket =\> “basket” table

Is there a way to handle these two tables ?

---

<div class="post-metadata">

**Author:** ![anon21153075](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@anon21153075](https://community.forestadmin.com/u/anon21153075)\
**Post date:** [June 23, 2022, 4:02pm UTC](https://community.forestadmin.com/t/collection-named-geopardized-laravel-package/4891/5 "2022-06-23T16:02:54Z")

</div>

Yes this is the current behaviour of our agent.

Actually we have a feature that could help you.

You can try this feature by adding this line into your composer.json

```javascript
"repositories": [
    {
        "type": "git",
        "url": "https://github.com/ForestAdmin/laravel-forestadmin.git"
    }
],
 "require": {
   ...
   "forestadmin/laravel-forestadmin": "dev-feat/multi-directories-models",
   ...
},

```

The `config/forest.php` has been slightly changed.

You can remove the `'models_namespace'` key and replace` 'models_directory' => env('MODEL_DIRECTORY', 'app/Models/')` by `'models_directory' => ['app/Models']`.

We have just updated it and now you can set a custom name on your collection.

First you need to use our trait `ForestAdmin\LaravelForestAdmin\Services\Concerns\ForestCollection` into your models and set a custom name with the method forestName.

Then you need to update your .forestadmin-schema.json.

Example:

```javascript
use ForestAdmin\LaravelForestAdmin\Services\Concerns\ForestCollection;

class Book extends Model
{
    use ForestCollection;

    public function forestName() {
        return 'Comics';
}

```

---

<div class="post-metadata">

**Author:** ![anon21153075](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@anon21153075](https://community.forestadmin.com/u/anon21153075)\
**Post date:** [June 29, 2022, 8:01am UTC](https://community.forestadmin.com/t/collection-named-geopardized-laravel-package/4891/6 "2022-06-29T08:01:48Z")

</div>

Hi @storm23 ,

This feature is now available in the latest version (v1.1.1) of laravel-forestadmin.
