getOldAttribute('count'); // VarDumper::dump($changed); // VarDumper::dump($this->getDirtyAttributes(['count'])); $this->oldCount = $this->getOldAttribute('count'); } return true; } public function afterSave($insert, $changedAttributes){ $product = Product::findOne($this->id_product); $product->stock = $product->stock - $this->oldCount + $this->count; $product->save(false); Log::log([ 'id_product' => $this->product->id_product, 'type' =>Log::$TYPE_PROCUREMENT_UPDATE, 'message' => "Beszerzés(#".$this->id_procurement.") módosítva. Beszerzett mennyiség: " . $this->oldCount . " > " .$this->count, ]); } }