| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- use Illuminate\Database\Eloquent\SoftDeletes;
- /**
- * @property int $id
- * @property int $unit_id
- * @property int|null $class_package_id
- * @property string $name
- * @property int $quantity_classes
- * @property float $contract_value
- * @property float $contract_material_value
- * @property float $contract_register_value
- * @property float|null $contrat_discount_value
- * @property bool $visible
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- */
- class ClassPackageUnit extends Model
- {
- use HasFactory, SoftDeletes;
- protected $table = 'class_package_units';
- protected $guarded = ['id'];
- protected $casts = [
- 'quantity_classes' => 'integer',
- 'contract_value' => 'float',
- 'contract_material_value' => 'float',
- 'contract_register_value' => 'float',
- 'contrat_discount_value' => 'float',
- 'visible' => 'boolean',
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- ];
- public function unit(): BelongsTo
- {
- return $this->belongsTo(Unit::class);
- }
- public function basePackage(): BelongsTo
- {
- return $this->belongsTo(ClassPackage::class, 'class_package_id');
- }
- public function products(): HasMany
- {
- return $this->hasMany(ClassPackageUnitProduct::class);
- }
- }
|