How to group this code ?
Hi anyone knows how to group the calling function , so I can just initialize once .
php (new Appointment())->getAvailableTimes($get('date'))
php (new Appointment())->getAvailableTimes($get('date'))
Select::make('slot')
->prefixIcon(fn (Get $get, ?Model $record) =>
(new Appointment())->getAvailableTimes($get('date')) != null ? 'heroicon-o-check' : "heroicon-o-x-mark"
)
->prefixIconColor(fn (Get $get, ?Model $record) =>
(new Appointment())->getAvailableTimes($get('date')) != null ? 'primary' : "gray"
)
->disabled(fn (Get $get, ?Model $record) =>
(new Appointment())->getAvailableTimes($get('date')) != null ?
)
->options(fn (Get $get, ?Model $record) =>
(new Appointment())->getAvailableTimes($get('date'))
)
Select::make('slot')
->prefixIcon(fn (Get $get, ?Model $record) =>
(new Appointment())->getAvailableTimes($get('date')) != null ? 'heroicon-o-check' : "heroicon-o-x-mark"
)
->prefixIconColor(fn (Get $get, ?Model $record) =>
(new Appointment())->getAvailableTimes($get('date')) != null ? 'primary' : "gray"
)
->disabled(fn (Get $get, ?Model $record) =>
(new Appointment())->getAvailableTimes($get('date')) != null ?
)
->options(fn (Get $get, ?Model $record) =>
(new Appointment())->getAvailableTimes($get('date'))
)
1 Reply
I am thinking to do something like this
Need help!
Anyone?
Select::make('slot'
->group(function (Get $get, ?Model $record, $select) {
$bool = true;
$select->prefixIcon($bool ? 'heroicon-o-check' : "heroicon-o-x-mark")
->prefixIconColor(...)...
})
Select::make('slot'
->group(function (Get $get, ?Model $record, $select) {
$bool = true;
$select->prefixIcon($bool ? 'heroicon-o-check' : "heroicon-o-x-mark")
->prefixIconColor(...)...
})