Refactor bonos de transporte
This commit is contained in:
parent
83dd00858b
commit
1da3d6db92
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Constants;
|
use App\Utils\TransporteUtils;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
@ -85,8 +85,7 @@ function totalTransporte() : int {
|
||||||
if ($this->productos()->every(fn($prod) => !$prod->pagaTransporte()))
|
if ($this->productos()->every(fn($prod) => !$prod->pagaTransporte()))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
$cantidad = 1 + floor($this->total($this->productosConTransporte()) / Constants::DIVISOR_TRANSPORTE);
|
return TransporteUtils::total($this->productosConTransporte());
|
||||||
return $cantidad * Constants::COSTO_TRANSPORTE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue