OrderOverviewModel.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Models;
  3. use App\Models\BaseModel;
  4. use Illuminate\Database\Eloquent\Model;
  5. class OrderOverviewModel extends BaseModel
  6. {
  7. /**
  8. * 数据表名
  9. *
  10. * @var string
  11. *
  12. */
  13. protected $table = 'order_overview';
  14. /**
  15. 主键
  16. */
  17. protected $primaryKey = 'id';
  18. //分页
  19. protected $perPage = PAGE_NUMS;
  20. /**
  21. * 可以被集体附值的表的字段
  22. *
  23. * @var string
  24. */
  25. protected $fillable = [
  26. // 'name',
  27. // 'sort',
  28. 'status'
  29. ];
  30. public static function getOptions(){
  31. return self::where('id', '>', 0)->get()->toArray();
  32. }
  33. public function projects(){
  34. return $this->hasOne(Project::class,'id','project_id');
  35. }
  36. public function user(){
  37. return $this->hasOne(User::class,'id','confirmation_user_id');
  38. }
  39. public function device()
  40. {
  41. return $this->hasOne(Device::class,'id','device_id');
  42. }
  43. public function device_name()
  44. {
  45. return $this->hasOne(DeviceName::class,'id','device_name_id');
  46. }
  47. public function spec()
  48. {
  49. return $this->hasOne(Spec::class,'id','spec_id');
  50. }
  51. }