404 error on create

Someone please help me because Im going crazy 😭
<?php

namespace App\Filament\Resources;

use App\Filament\Resources\MovieResource\Pages;
use App\Models\Movie;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Forms\Set;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\Action;
use Filament\Tables\Columns\ImageColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
use Livewire\Component as Livewire;

class MovieResource extends Resource
{
protected static ?string $model = Movie::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

public static function form(Form $form): Form
{
return $form
->schema([
// ...
]);
}

public static function table(Table $table): Table
{
// ...
}

public static function getRelations(): array
{
return [
//
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListMovies::route('/'),
'view' => Pages\ViewMovie::route('/{record}'),
'create' => Pages\CreateMovie::route('/create'),
// 'edit' => Pages\EditMovie::route('/{record}/edit'),
];
}
}
<?php

namespace App\Filament\Resources;

use App\Filament\Resources\MovieResource\Pages;
use App\Models\Movie;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Forms\Set;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\Action;
use Filament\Tables\Columns\ImageColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
use Livewire\Component as Livewire;

class MovieResource extends Resource
{
protected static ?string $model = Movie::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

public static function form(Form $form): Form
{
return $form
->schema([
// ...
]);
}

public static function table(Table $table): Table
{
// ...
}

public static function getRelations(): array
{
return [
//
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListMovies::route('/'),
'view' => Pages\ViewMovie::route('/{record}'),
'create' => Pages\CreateMovie::route('/create'),
// 'edit' => Pages\EditMovie::route('/{record}/edit'),
];
}
}
<?php

namespace App\Filament\Resources\MovieResource\Pages;

use App\Filament\Resources\MovieResource;
use Filament\Resources\Pages\CreateRecord;

class CreateMovie extends CreateRecord
{
protected static string $resource = MovieResource::class;
}
<?php

namespace App\Filament\Resources\MovieResource\Pages;

use App\Filament\Resources\MovieResource;
use Filament\Resources\Pages\CreateRecord;

class CreateMovie extends CreateRecord
{
protected static string $resource = MovieResource::class;
}
When I visit the create page, Im met with this error:
No description
Solution:
move create ```php return [ 'index' => Pages\ListMovies::route('/'),...
Jump to solution
6 Replies
Matthew
MatthewOP6mo ago
If I print the routes, the create route is there:
GET|HEAD app/movies/create filament.app.resources.movies.create › App\Filament\Resources\MovieResource\Page…
GET|HEAD app/movies/create filament.app.resources.movies.create › App\Filament\Resources\MovieResource\Page…
Solution
LeandroFerreira
LeandroFerreira6mo ago
move create
return [
'index' => Pages\ListMovies::route('/'),
'create' => Pages\CreateMovie::route('/create'),
'view' => Pages\ViewMovie::route('/{record}'),
];
return [
'index' => Pages\ListMovies::route('/'),
'create' => Pages\CreateMovie::route('/create'),
'view' => Pages\ViewMovie::route('/{record}'),
];
Matthew
MatthewOP6mo ago
OMG 🤣 🤣 🤣 🤣. Thank you Why is this a thing?
Matthew
MatthewOP6mo ago
Ive been trying for hours xd
LeandroFerreira
LeandroFerreira6mo ago
The view route includes a record parameter. If you add the create route after the view route, the app will interpret create as a record within the view route
Matthew
MatthewOP6mo ago
Ohhh, ok. Thanks for your explanation 🙂
Want results from more Discord servers?
Add your server