IrrecusableProposalUnit.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  6. use Illuminate\Database\Eloquent\Relations\HasMany;
  7. use Illuminate\Database\Eloquent\SoftDeletes;
  8. /**
  9. * @property int $id
  10. * @property int $class_package_unit_id
  11. * @property int|null $irrecusable_proposal_id
  12. * @property float|null $registration_value
  13. * @property float|null $classes_value
  14. * @property float|null $classes_discount_percentage
  15. * @property float $materials_total_value
  16. * @property float|null $total_value
  17. * @property int $total_max_installments
  18. * @property string|null $condition
  19. * @property-read \App\Models\ClassPackageUnit $packageUnit
  20. * @property-read \App\Models\IrrecusableProposal|null $baseIrrecusableProposal
  21. * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\IrrecusableProposalUnitProduct> $products
  22. */
  23. class IrrecusableProposalUnit extends Model
  24. {
  25. use HasFactory, SoftDeletes;
  26. protected $table = 'irrecusable_proposal_units';
  27. protected $guarded = ['id'];
  28. protected $casts = [
  29. 'registration_value' => 'float',
  30. 'classes_value' => 'float',
  31. 'classes_discount_percentage' => 'float',
  32. 'materials_total_value' => 'float',
  33. 'total_value' => 'float',
  34. 'total_max_installments' => 'integer',
  35. ];
  36. public function packageUnit(): BelongsTo
  37. {
  38. return $this->belongsTo(ClassPackageUnit::class, 'class_package_unit_id');
  39. }
  40. public function baseIrrecusableProposal(): BelongsTo
  41. {
  42. return $this->belongsTo(IrrecusableProposal::class, 'irrecusable_proposal_id');
  43. }
  44. public function products(): HasMany
  45. {
  46. return $this->hasMany(IrrecusableProposalUnitProduct::class);
  47. }
  48. }