© 2026 Hedgehog Software, LLC

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

Custom properties on Create Page causes 404

I'm passing the parent ID as route parameter and want to save it into a custom property named
$series
$series
on the page but when I define the property on the
CreatePage
CreatePage
component it triggers a 404 error, when removed it works fine.
So, I cannot define custom livewire state on my page or am I missing something?

<?php

namespace App\Filament\Resources\Content\ChapterResource\Pages;

use App\Filament\Resources\Content\ChapterResource;
use App\Models\Content\Series;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Routing\Exceptions\UrlGenerationException;

class CreateChapter extends CreateRecord
{
    protected static string $resource = ChapterResource::class;

    // THE FOLLOWING LINE GIVES 404 ERROR, WHEN REMOVED THE PAGE LOADS
    public ?Series $series = null;

    public function mount(): void
    {
        $series_id = request()->route('series');

        if (!$series_id || !is_numeric($series_id))
            throw new UrlGenerationException('Invalid series provided!');

        dd($series_id);

        $this->series = Series::findOrFail($series_id);

        parent::mount();
    }

    /**
     * {@inheritdoc}
     */
    public function getBreadcrumbs(): array
    {
        return [];
    }

    protected function mutateFormDataBeforeCreate(array $data): array
    {
        dd($this->series);

        $data['series_id'] = $this->series->id;

        return $data;
    }
}
<?php

namespace App\Filament\Resources\Content\ChapterResource\Pages;

use App\Filament\Resources\Content\ChapterResource;
use App\Models\Content\Series;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Routing\Exceptions\UrlGenerationException;

class CreateChapter extends CreateRecord
{
    protected static string $resource = ChapterResource::class;

    // THE FOLLOWING LINE GIVES 404 ERROR, WHEN REMOVED THE PAGE LOADS
    public ?Series $series = null;

    public function mount(): void
    {
        $series_id = request()->route('series');

        if (!$series_id || !is_numeric($series_id))
            throw new UrlGenerationException('Invalid series provided!');

        dd($series_id);

        $this->series = Series::findOrFail($series_id);

        parent::mount();
    }

    /**
     * {@inheritdoc}
     */
    public function getBreadcrumbs(): array
    {
        return [];
    }

    protected function mutateFormDataBeforeCreate(array $data): array
    {
        dd($this->series);

        $data['series_id'] = $this->series->id;

        return $data;
    }
}
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

404 create page
FilamentFFilament / ❓┊help
3y ago
New Custom Page 404
FilamentFFilament / ❓┊help
2y ago
Create action on custom page
FilamentFFilament / ❓┊help
2y ago
Create custom page error
FilamentFFilament / ❓┊help
13mo ago