Pedroesca
FooterActions method not present in Filament\Forms\Components\Section;
Now it updated correctly, but it started to show me the error "Undefined type 'Filament\Tables\Columns\TextColumn'.intelephense(P1009)" in ->columns([
TextColumn::make('status')) of my resources
12 replies
beforeSave whith relations
La única forma que encontré para solucionar fue:
1. en afterFill (EditSale)
protected function afterFill(): void
{
if ($this->record->draft == 1) {
return; // Salir del método si la venta está en borrador
}
$this->originalDetails = $this->record->products->toArray();
session()->put('originalDetails', $this->record->products->toArray());
}
2. y en beforeSave recupero el registro original
protected function beforeSave(): void
{
if ($this->record->draft === 1) {
return; // Salir del método si la venta está en borrador
}
$this->originalDetails = session()->get('originalDetails', []);
foreach ($this->originalDetails as $detail){
// Obtener el producto relacionado
$product = Product::find($detail['product_id']);
if ($product){
//REVERTIR STOCK
$stockActual = $product->stock_current;
11 replies