Просто добавил ресурс нити «клиенты» и некоторые базовые текстовые входы в форму и таблицу:
Код: Выделить всё
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('first_name')
->label('First Name')
->required(),
TextInput::make('last_name')
->label('Last Name')
->required(),
TextInput::make('phone_number')
->label('Phone number')
->required(),
TextInput::make('email')
->label('Email')
->required(),
Select::make('status')
->options(collect(CustomerStatus::cases())->mapWithKeys(fn($case) => [$case->value => $case->getLabel()]))
->default(CustomerStatus::NEW),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('first_name')
->label('First Name')
->searchable(),
TextColumn::make('last_name')
->label('Last Name')
->searchable(),
TextColumn::make('status')
->label('Status')
->badge(),
TextColumn::make('phone_number')
->label('Phone number')
->searchable(),
TextColumn::make('email')
->label('Email')
->searchable(),
TextColumn::make('created_at')
->label('Created at')
->dateTime(),
])
->filters([
SelectFilter::make('status')
->label('Status')
->options(CustomerStatus::class),
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}
страница панели администратора
некоторые ошибки консоли
Подробнее здесь: https://stackoverflow.com/questions/791 ... -correctly
Мобильная версия