PartTrack.php 859 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Models;
  3. use Dcat\Admin\Traits\HasDateTimeFormatter;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\Relations\HasOne;
  6. use Illuminate\Database\Eloquent\SoftDeletes;
  7. /**
  8. * @method static where(string $key, string $value)
  9. *
  10. * @property int part_id
  11. * @property int device_id
  12. */
  13. class PartTrack extends Model
  14. {
  15. use HasDateTimeFormatter;
  16. use SoftDeletes;
  17. protected $table = 'part_tracks';
  18. /**
  19. * 配件追踪有一个配件记录.
  20. *
  21. * @return HasOne
  22. */
  23. public function part(): HasOne
  24. {
  25. return $this->hasOne(PartRecord::class, 'id', 'part_id');
  26. }
  27. /**
  28. * 配件追踪有一个设备记录.
  29. *
  30. * @return HasOne
  31. */
  32. public function device(): HasOne
  33. {
  34. return $this->hasOne(DeviceRecord::class, 'id', 'device_id');
  35. }
  36. }