New instantly creates a new record
Hi,
I tried to make a simple resource and I got this right now:
But when creating it instantly creates a empty record (yes fields are now nullable for testing)
<?php
namespace Joebatta\Sooposted\Filament\Resources;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Joebatta\Sooposted\Filament\Resources\AccountResource\Pages\ManageAccounts;
use Joebatta\Sooposted\Models\Account;
class AccountResource extends Resource
{
protected static ?string $model = Account::class;
protected static ?string $navigationGroup = 'Test';
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
{
return $table
->contentGrid([
//
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
])
->emptyStateActions([
Tables\Actions\CreateAction::make(),
]);
}
public static function getPages(): array
{
return [
'index' => ManageAccounts::route('/'),
];
}
}
<?php
namespace Joebatta\Sooposted\Filament\Resources;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Joebatta\Sooposted\Filament\Resources\AccountResource\Pages\ManageAccounts;
use Joebatta\Sooposted\Models\Account;
class AccountResource extends Resource
{
protected static ?string $model = Account::class;
protected static ?string $navigationGroup = 'Test';
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
{
return $table
->contentGrid([
//
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
])
->emptyStateActions([
Tables\Actions\CreateAction::make(),
]);
}
public static function getPages(): array
{
return [
'index' => ManageAccounts::route('/'),
];
}
}
2 Replies