Skip to content

Commit 5da0db9

Browse files
committed
refactor: remove unnecessary handleRecordCreation override
Custom fields now handle creation automatically via model lifecycle hooks
1 parent 9d492ea commit 5da0db9

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

tests/Fixtures/Resources/Posts/Pages/CreatePost.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,9 @@
33
namespace Relaticle\CustomFields\Tests\Fixtures\Resources\Posts\Pages;
44

55
use Filament\Resources\Pages\CreateRecord;
6-
use Illuminate\Database\Eloquent\Model;
7-
use Illuminate\Support\Arr;
86
use Relaticle\CustomFields\Tests\Fixtures\Resources\Posts\PostResource;
97

108
class CreatePost extends CreateRecord
119
{
1210
protected static string $resource = PostResource::class;
13-
14-
protected function handleRecordCreation(array $data): Model
15-
{
16-
// Extract custom fields before creating the record
17-
$customFields = Arr::pull($data, 'custom_fields');
18-
19-
// Create the record with remaining data
20-
$record = static::getModel()::create($data);
21-
22-
// Save custom fields if they exist
23-
if ($customFields && method_exists($record, 'saveCustomFields')) {
24-
$record->saveCustomFields($customFields);
25-
}
26-
27-
return $record;
28-
}
2911
}

0 commit comments

Comments
 (0)