IrrecusableProposalUnit.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 bool $registration_included_in_course
  14. * @property bool $registration_installments_allowed
  15. * @property int $registration_max_installments
  16. * @property float|null $classes_value
  17. * @property bool $classes_included_in_course
  18. * @property bool $classes_installments_allowed
  19. * @property int $classes_max_installments
  20. * @property float|null $classes_discount_percentage
  21. * @property float $materials_total_value
  22. * @property bool $materials_included_in_course
  23. * @property bool $materials_installments_allowed
  24. * @property int $materials_max_installments
  25. * @property float|null $total_value
  26. * @property int $total_max_installments
  27. * @property string|null $condition
  28. * @property-read \App\Models\ClassPackageUnit $packageUnit
  29. * @property-read \App\Models\IrrecusableProposal|null $baseIrrecusableProposal
  30. * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\IrrecusableProposalUnitProduct> $products
  31. */
  32. class IrrecusableProposalUnit extends Model
  33. {
  34. use HasFactory, SoftDeletes;
  35. protected $table = 'irrecusable_proposal_units';
  36. protected $guarded = ['id'];
  37. protected $casts = [
  38. 'registration_value' => 'float',
  39. 'registration_included_in_course' => 'boolean',
  40. 'registration_installments_allowed' => 'boolean',
  41. 'registration_max_installments' => 'integer',
  42. 'classes_value' => 'float',
  43. 'classes_included_in_course' => 'boolean',
  44. 'classes_installments_allowed' => 'boolean',
  45. 'classes_max_installments' => 'integer',
  46. 'classes_discount_percentage' => 'float',
  47. 'materials_total_value' => 'float',
  48. 'materials_included_in_course' => 'boolean',
  49. 'materials_installments_allowed' => 'boolean',
  50. 'materials_max_installments' => 'integer',
  51. 'total_value' => 'float',
  52. 'total_max_installments' => 'integer',
  53. ];
  54. public function packageUnit(): BelongsTo
  55. {
  56. return $this->belongsTo(ClassPackageUnit::class, 'class_package_unit_id');
  57. }
  58. public function baseIrrecusableProposal(): BelongsTo
  59. {
  60. return $this->belongsTo(IrrecusableProposal::class, 'irrecusable_proposal_id');
  61. }
  62. public function products(): HasMany
  63. {
  64. return $this->hasMany(IrrecusableProposalUnitProduct::class);
  65. }
  66. }