From 9e5ea214adb4395934ca258c4999fee7b6fa51b4 Mon Sep 17 00:00:00 2001 From: Achyut Neupane Date: Tue, 31 Dec 2024 22:32:35 +0545 Subject: [PATCH 1/3] In CanGenerateModelForms trait --- .../Commands/FileGenerators/Concerns/CanGenerateModelForms.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/forms/src/Commands/FileGenerators/Concerns/CanGenerateModelForms.php b/packages/forms/src/Commands/FileGenerators/Concerns/CanGenerateModelForms.php index 51781f5ac7d..15ac9f82be0 100644 --- a/packages/forms/src/Commands/FileGenerators/Concerns/CanGenerateModelForms.php +++ b/packages/forms/src/Commands/FileGenerators/Concerns/CanGenerateModelForms.php @@ -8,6 +8,7 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\Textarea; use Filament\Forms\Components\TextInput; +use Filament\Forms\Components\TimePicker; use Filament\Forms\Components\Toggle; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Str; @@ -89,6 +90,7 @@ public function getFormComponents(?string $model = null, array $exceptColumns = $componentData['type'] = match (true) { $type['name'] === 'boolean' => Toggle::class, $type['name'] === 'date' => DatePicker::class, + $type['name'] === 'time' => TimePicker::class, in_array($type['name'], ['datetime', 'timestamp']) => DateTimePicker::class, $type['name'] === 'text' => Textarea::class, $componentName === 'image', str($componentName)->startsWith('image_'), str($componentName)->contains('_image_'), str($componentName)->endsWith('_image') => FileUpload::class, From 871ec75815e1f92da141e9aef80f287f7779dfe7 Mon Sep 17 00:00:00 2001 From: Achyut Neupane Date: Tue, 31 Dec 2024 22:33:51 +0545 Subject: [PATCH 2/3] In CanGenerateModelTables trait --- .../FileGenerators/Concerns/CanGenerateModelTables.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/tables/src/Commands/FileGenerators/Concerns/CanGenerateModelTables.php b/packages/tables/src/Commands/FileGenerators/Concerns/CanGenerateModelTables.php index a40d9edfc20..1ff720e232e 100644 --- a/packages/tables/src/Commands/FileGenerators/Concerns/CanGenerateModelTables.php +++ b/packages/tables/src/Commands/FileGenerators/Concerns/CanGenerateModelTables.php @@ -142,6 +142,13 @@ public function getTableColumns(?string $model = null, array $exceptColumns = [] $columnData['sortable'] = []; } + if (in_array($type['name'], [ + 'time', + ])) { + $columnData['time'] = []; + $columnData['sortable'] = []; + } + if (in_array($type['name'], [ 'datetime', 'timestamp', From 63397f6abcaa27ef2d494a10f87e5a83bfaa2cee Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Thu, 2 Jan 2025 08:15:06 +0000 Subject: [PATCH 3/3] Update CanGenerateModelTables.php --- .../FileGenerators/Concerns/CanGenerateModelTables.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/tables/src/Commands/FileGenerators/Concerns/CanGenerateModelTables.php b/packages/tables/src/Commands/FileGenerators/Concerns/CanGenerateModelTables.php index 1ff720e232e..677f7149557 100644 --- a/packages/tables/src/Commands/FileGenerators/Concerns/CanGenerateModelTables.php +++ b/packages/tables/src/Commands/FileGenerators/Concerns/CanGenerateModelTables.php @@ -135,16 +135,12 @@ public function getTableColumns(?string $model = null, array $exceptColumns = [] $columnData['searchable'] = []; } - if (in_array($type['name'], [ - 'date', - ])) { + if ($type['name'] === 'date') { $columnData['date'] = []; $columnData['sortable'] = []; } - if (in_array($type['name'], [ - 'time', - ])) { + if ($type['name'] === 'time') { $columnData['time'] = []; $columnData['sortable'] = []; }