class BookedSlots extends Component implements HasTable, HasForms
{
use InteractsWithTable, InteractsWithForms;
public ?array $data = [];
public function mount()
{
$this->form->fill(Slot::with('event')->get()->toArray());
}
public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('reason'),
])
->statePath('data')
->model(Slot::class);
}
public function create(): void
{
$data = $this->form->getState();
dd($data);
$this->record->update($data);
}
public function table(Table $table): Table
{
return $table
->query(Slot::with('event')->where('user_id', Auth::id()))
->columns([
TextColumn::make('event.name')->searchable()->sortable()->label('Event Name')
])
->actions([
EditAction::make(),
]);
}
class BookedSlots extends Component implements HasTable, HasForms
{
use InteractsWithTable, InteractsWithForms;
public ?array $data = [];
public function mount()
{
$this->form->fill(Slot::with('event')->get()->toArray());
}
public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('reason'),
])
->statePath('data')
->model(Slot::class);
}
public function create(): void
{
$data = $this->form->getState();
dd($data);
$this->record->update($data);
}
public function table(Table $table): Table
{
return $table
->query(Slot::with('event')->where('user_id', Auth::id()))
->columns([
TextColumn::make('event.name')->searchable()->sortable()->label('Event Name')
])
->actions([
EditAction::make(),
]);
}