© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Tieme

Error on creating resource with custom --model-namespace

Hi All,

I want to create a resource with following command
php artisan make:filament-resource Customer --generate --soft-deletes --view --model-namespace=App\\Models\\Team
php artisan make:filament-resource Customer --generate --soft-deletes --view --model-namespace=App\\Models\\Team

as documented here https://filamentphp.com/docs/3.x/panels/resources/getting-started#specifiying-a-custom-model-namespace

This throws me a Fatal error :

PHP Fatal error:  Cannot declare class App\Models\Team\Customer, because the name is already in use in C:\Users\***\PHPStormProjects\***\app\Models\Team\Customer.php on line 14

   Symfony\Component\ErrorHandler\Error\FatalError 

  Cannot declare class App\Models\Team\Customer, because the name is already in use

  at app\Models\Team\Customer.php:14
     10▕ use Illuminate\Database\Eloquent\Model;
     11▕ use Illuminate\Database\Eloquent\Relations\BelongsTo;
     12▕ use Illuminate\Database\Eloquent\SoftDeletes;
     13▕
  ➜  14▕ class Customer extends Model
     15▕ {
     16▕     use BelongsToTeam;
     17▕     use HasFactory;
     18▕     use HasUserStamps;


   Whoops\Exception\ErrorException 

  Cannot declare class App\Models\Team\Customer, because the name is already in use

  at app\Models\Team\Customer.php:14
     10▕ use Illuminate\Database\Eloquent\Model;
     11▕ use Illuminate\Database\Eloquent\Relations\BelongsTo;
     12▕ use Illuminate\Database\Eloquent\SoftDeletes;
     13▕
  ➜  14▕ class Customer extends Model
     15▕ {
     16▕     use BelongsToTeam;
     17▕     use HasFactory;
     18▕     use HasUserStamps;

  1   vendor\filp\whoops\src\Whoops\Run.php:514
      Whoops\Run::handleError("Cannot declare class App\Models\Team\Customer, because the name is already in use", "C:\Users\***\PHPStormProjects\***\app\Models\Team\Customer.php")

  2   [internal]:0
      Whoops\Run::handleShutdown()
PHP Fatal error:  Cannot declare class App\Models\Team\Customer, because the name is already in use in C:\Users\***\PHPStormProjects\***\app\Models\Team\Customer.php on line 14

   Symfony\Component\ErrorHandler\Error\FatalError 

  Cannot declare class App\Models\Team\Customer, because the name is already in use

  at app\Models\Team\Customer.php:14
     10▕ use Illuminate\Database\Eloquent\Model;
     11▕ use Illuminate\Database\Eloquent\Relations\BelongsTo;
     12▕ use Illuminate\Database\Eloquent\SoftDeletes;
     13▕
  ➜  14▕ class Customer extends Model
     15▕ {
     16▕     use BelongsToTeam;
     17▕     use HasFactory;
     18▕     use HasUserStamps;


   Whoops\Exception\ErrorException 

  Cannot declare class App\Models\Team\Customer, because the name is already in use

  at app\Models\Team\Customer.php:14
     10▕ use Illuminate\Database\Eloquent\Model;
     11▕ use Illuminate\Database\Eloquent\Relations\BelongsTo;
     12▕ use Illuminate\Database\Eloquent\SoftDeletes;
     13▕
  ➜  14▕ class Customer extends Model
     15▕ {
     16▕     use BelongsToTeam;
     17▕     use HasFactory;
     18▕     use HasUserStamps;

  1   vendor\filp\whoops\src\Whoops\Run.php:514
      Whoops\Run::handleError("Cannot declare class App\Models\Team\Customer, because the name is already in use", "C:\Users\***\PHPStormProjects\***\app\Models\Team\Customer.php")

  2   [internal]:0
      Whoops\Run::handleShutdown()


How can i handle custom model namespace ?
i already have tried
--model-namespace=App\\Models\\Team\\Customer
--model-namespace=App\\Models\\Team\\Customer
this wil create the resource, only not generate all the fields for me and also namespace is wrong.
Getting started - Panel Builder - Filament
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Auto Creating Child Model from Parent Resource
FilamentFFilament / ❓┊help
2y ago
Custom page with resource record error
FilamentFFilament / ❓┊help
14mo ago
creating new resource show error
FilamentFFilament / ❓┊help
3y ago
withoutGlobalScopes on Custom Page with Resource
FilamentFFilament / ❓┊help
3y ago