You don't have to save the model object inside the model event handler, it will eventually be saved, so this is enough:
protected static function boot()
{
parent::boot();
static::saving(function ($model){
if ($model->Qty <= 0)
{
$model->Status ='Not Available';
}
if ($model->Qty <= 5 && $model->Qty >= 1)
{
$model->Status ='Reorder level';
}
});
}
Pls update and try again.
zworthkey liked this reply
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community