ProductionOrderInstallation.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Models;
  4. use Database\Factories\ProductionOrderInstallationFactory;
  5. use Illuminate\Database\Eloquent\Factories\HasFactory;
  6. use Illuminate\Database\Eloquent\Model;
  7. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  8. use Illuminate\Database\Eloquent\SoftDeletes;
  9. class ProductionOrderInstallation extends Model
  10. {
  11. /** @use HasFactory<ProductionOrderInstallationFactory> */
  12. use HasFactory;
  13. use SoftDeletes;
  14. protected $fillable = [
  15. 'production_order_id',
  16. 'installation_date',
  17. 'installation_days',
  18. 'brigadier_id',
  19. 'note',
  20. 'created_by',
  21. 'updated_by',
  22. ];
  23. protected function casts(): array
  24. {
  25. return [
  26. 'production_order_id' => 'integer',
  27. 'installation_date' => 'immutable_date',
  28. 'installation_days' => 'integer',
  29. 'brigadier_id' => 'integer',
  30. 'created_by' => 'integer',
  31. 'updated_by' => 'integer',
  32. ];
  33. }
  34. public function productionOrder(): BelongsTo
  35. {
  36. return $this->belongsTo(ProductionOrder::class);
  37. }
  38. public function brigadier(): BelongsTo
  39. {
  40. return $this->belongsTo(User::class, 'brigadier_id');
  41. }
  42. }