filament-fabricator: Undefined array key 1 related to PageRoutesService

i am getting this error when trying to clear config, route etc. i don’t know how to solve it. Anyone got any ideas?


at vendor\z3d0x\filament-fabricator\src\Services\PageRoutesService.php:87
   83▕     public function removeUrlsOf(Page $page): void
   84▕     {
   85▕         // First remove the entries from the (ID -> URI) mapping
   86▕         $idToUrlsMapping = $this->getIdToUrisMapping();
➜  87▕         $urls = $idToUrlsMapping[$page->id];
   88▕         $idToUrlsMapping[$page->id] = null;
   89▕         unset($idToUrlsMapping[$page->id]);
   90▕         $this->replaceIdToUriMapping($idToUrlsMapping);
   91▕

1   vendor\z3d0x\filament-fabricator\src\Services\PageRoutesService.php:87
    Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}("Undefined array key 1", "C:\xampp\htdocs\nextxlfabricator\vendor\z3d0x\filament-fabricator\src\Services\PageRoutesService.php")

2   vendor\z3d0x\filament-fabricator\src\Commands\ClearRoutesCacheCommand.php:47
    Z3d0X\FilamentFabricator\Services\PageRoutesService::removeUrlsOf(Object(Z3d0X\FilamentFabricator\Models\Page))```

I did composer update. After this I started getting this error after config:clear or route:clear. And the fabricator pages were giving a 404.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 33 (2 by maintainers)

Commits related to this issue

Most upvoted comments

this is config/filament-fabricator.php


// config for Z3d0X/FilamentFabricator
return [
    'routing' => [
        'enabled' => true,
        'prefix' => null, //    /pages
    ],

    'layouts' => [
        'namespace' => 'App\\Filament\\Fabricator\\Layouts',
        'path' => app_path('Filament/Fabricator/Layouts'),
        'register' => [
            //
        ],
    ],

    'page-blocks' => [
        'namespace' => 'App\\Filament\\Fabricator\\PageBlocks',
        'path' => app_path('Filament/Fabricator/PageBlocks'),
        'register' => [
            //
        ],
    ],

    'middleware' => [
        \Illuminate\Cookie\Middleware\EncryptCookies::class,
        \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
        \Illuminate\Session\Middleware\StartSession::class,
        // \Illuminate\Session\Middleware\AuthenticateSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
        \Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class,
        \Illuminate\Routing\Middleware\SubstituteBindings::class,
    ],

    'page-model' => \Z3d0X\FilamentFabricator\Models\Page::class,

    'page-resource' => \Z3d0X\FilamentFabricator\Resources\PageResource::class,

    'enable-view-page' => false,

    /*
     * This is the name of the table that will be created by the migration and
     * used by the above page-model shipped with this package.
     */
    'table_name' => 'pages',
];