3👍
You can use observers for this. Add this in your Article
model:
protected static function boot()
{
parent::boot();
// this triggers everytime an Article model is saved
static::saved(function (Article $article) {
$history = new History();
$history->nombre = $article->nombre;
$history->precio_proveedor = $article->precio_proveedor;
$history->stock = $article->stock;
$history->save();
});
}
Reference: https://www.larashout.com/how-to-use-laravel-model-observers
- [Vuejs]-Vuepress multiple sidebar don't show all items
- [Vuejs]-Format date within template interpolation – vue js
Source:stackexchange.com