TextInputColumn::make('route_id')
->rules(['numeric', 'integer', 'min:1'])
->extraAttributes(['style' => 'min-width:60px'])
->updateStateUsing(function ($state, $record) {
if ($state > 1 || $state !== null) {
$route = Route::find($state);
if (!$route) {
// Trigger the createRoute action if the route does not exist
return Action::make('createRoute')
->form([
TextInput::make('name')->required()->maxLength(255),
ColorPicker::make('color')->required(),
])
->action(function (array $data) use ($state) {
$data['id'] = $state;
Route::create($data);
})
->modalHeading('Create Route')
->modalSubmitActionLabel('Create')
->modalWidth('lg')
->visible(fn () => true);
}
$groupOrderUpdater = app(UpdatesGroupOrders::class);
$groupOrderUpdater->update($record, ['route_id' => $state]);
}
return $record->route_id;
}),
TextInputColumn::make('route_id')
->rules(['numeric', 'integer', 'min:1'])
->extraAttributes(['style' => 'min-width:60px'])
->updateStateUsing(function ($state, $record) {
if ($state > 1 || $state !== null) {
$route = Route::find($state);
if (!$route) {
// Trigger the createRoute action if the route does not exist
return Action::make('createRoute')
->form([
TextInput::make('name')->required()->maxLength(255),
ColorPicker::make('color')->required(),
])
->action(function (array $data) use ($state) {
$data['id'] = $state;
Route::create($data);
})
->modalHeading('Create Route')
->modalSubmitActionLabel('Create')
->modalWidth('lg')
->visible(fn () => true);
}
$groupOrderUpdater = app(UpdatesGroupOrders::class);
$groupOrderUpdater->update($record, ['route_id' => $state]);
}
return $record->route_id;
}),