2626
2727class FamilyEventResource extends Resource
2828{
29+ use EventResourceTrait;
30+
2931 protected static ?string $ model = FamilyEvent::class;
3032
3133 protected static ?string $ navigationLabel = 'Family Events ' ;
@@ -38,117 +40,35 @@ class FamilyEventResource extends Resource
3840 public static function form (Schema $ schema ): Schema
3941 {
4042 return $ schema
41- ->components ([
42- TextInput::make ('family_id ' )
43- ->required ()
44- ->numeric (),
45- TextInput::make ('places_id ' )
46- ->numeric (),
47- Textarea::make ('date ' )
48- ->maxLength (65535 )
49- ->columnSpanFull (),
50- TextInput::make ('title ' )
51- ->maxLength (255 ),
52- Textarea::make ('description ' )
53- ->maxLength (65535 )
54- ->columnSpanFull (),
55- TextInput::make ('converted_date ' )
56- ->maxLength (255 ),
57- TextInput::make ('year ' )
58- ->numeric (),
59- TextInput::make ('month ' )
60- ->numeric (),
61- TextInput::make ('day ' )
62- ->numeric (),
63- TextInput::make ('type ' )
64- ->maxLength (255 ),
65- TextInput::make ('plac ' )
66- ->maxLength (255 ),
67- TextInput::make ('addr_id ' )
68- ->numeric (),
69- TextInput::make ('phon ' )
70- ->maxLength (255 ),
71- Textarea::make ('caus ' )
72- ->maxLength (65535 )
73- ->columnSpanFull (),
74- TextInput::make ('age ' )
75- ->maxLength (255 ),
76- TextInput::make ('agnc ' )
77- ->maxLength (255 ),
78- TextInput::make ('husb ' )
79- ->numeric (),
80- TextInput::make ('wife ' )
81- ->numeric (),
82- ]);
43+ ->components (array_merge (
44+ [TextInput::make ('family_id ' )->required ()->numeric ()],
45+ static ::eventFormFields (),
46+ [
47+ TextInput::make ('places_id ' )->numeric (),
48+ TextInput::make ('husb ' )->numeric (),
49+ TextInput::make ('wife ' )->numeric (),
50+ ]
51+ ));
8352 }
8453
8554 #[Override]
8655 public static function table (Table $ table ): Table
8756 {
8857 return $ table
89- ->columns ([
90- TextColumn::make ('family_id ' )
91- ->numeric ()
92- ->sortable (),
93- TextColumn::make ('places_id ' )
94- ->numeric ()
95- ->sortable (),
96- TextColumn::make ('title ' )
97- ->searchable (),
98- TextColumn::make ('converted_date ' )
99- ->searchable (),
100- TextColumn::make ('created_at ' )
101- ->dateTime ()
102- ->sortable ()
103- ->toggleable (isToggledHiddenByDefault: true ),
104- TextColumn::make ('updated_at ' )
105- ->dateTime ()
106- ->sortable ()
107- ->toggleable (isToggledHiddenByDefault: true ),
108- TextColumn::make ('deleted_at ' )
109- ->dateTime ()
110- ->sortable ()
111- ->toggleable (isToggledHiddenByDefault: true ),
112- TextColumn::make ('year ' )
113- ->numeric ()
114- ->sortable (),
115- TextColumn::make ('month ' )
116- ->numeric ()
117- ->sortable (),
118- TextColumn::make ('day ' )
119- ->numeric ()
120- ->sortable (),
121- TextColumn::make ('type ' )
122- ->searchable (),
123- TextColumn::make ('plac ' )
124- ->searchable (),
125- TextColumn::make ('addr_id ' )
126- ->numeric ()
127- ->sortable (),
128- TextColumn::make ('phon ' )
129- ->searchable (),
130- TextColumn::make ('age ' )
131- ->searchable (),
132- TextColumn::make ('agnc ' )
133- ->searchable (),
134- TextColumn::make ('husb ' )
135- ->numeric ()
136- ->sortable (),
137- TextColumn::make ('wife ' )
138- ->numeric ()
139- ->sortable (),
140- ])
141- ->filters ([
142- //
143- ])
144- ->recordActions ([
145- EditAction::make (),
146- ])
147- ->toolbarActions ([
148- BulkActionGroup::make ([
149- DeleteBulkAction::make (),
150- ]),
151- ]);
58+ ->columns (array_merge (
59+ [
60+ TextColumn::make ('family_id ' )->numeric ()->sortable (),
61+ TextColumn::make ('places_id ' )->numeric ()->sortable (),
62+ ],
63+ static ::eventTableColumns (),
64+ [
65+ TextColumn::make ('husb ' )->numeric ()->sortable (),
66+ TextColumn::make ('wife ' )->numeric ()->sortable (),
67+ ]
68+ ))
69+ ->filters ([])
70+ ->recordActions ([EditAction::make ()])
71+ ->toolbarActions ([BulkActionGroup::make ([DeleteBulkAction::make ()])]);
15272 }
15373
15474 #[Override]
0 commit comments