protected static string $relationship = 'steps';
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('title')
->default(
Step::where('recipe_id', $this->ownerRecord->id)
->orderBy('id', 'desc')
->value('title')
)
->required()
->maxLength(255),
Forms\Components\TextInput::make('step_number')
->default(
Step::where('recipe_id', $this->ownerRecord->id)
->max('step_number') + 1
)
->numeric()
->required(),
protected static string $relationship = 'steps';
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('title')
->default(
Step::where('recipe_id', $this->ownerRecord->id)
->orderBy('id', 'desc')
->value('title')
)
->required()
->maxLength(255),
Forms\Components\TextInput::make('step_number')
->default(
Step::where('recipe_id', $this->ownerRecord->id)
->max('step_number') + 1
)
->numeric()
->required(),