12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Models;
- use App\Models\BaseModel;
- use Illuminate\Database\Eloquent\Model;
- class OrderOverviewModel extends BaseModel
- {
- /**
- * 数据表名
- *
- * @var string
- *
- */
- protected $table = 'order_overview';
- /**
- 主键
- */
- protected $primaryKey = 'id';
- //分页
- protected $perPage = PAGE_NUMS;
- /**
- * 可以被集体附值的表的字段
- *
- * @var string
- */
- protected $fillable = [
- // 'name',
- // 'sort',
- 'status'
- ];
- public static function getOptions(){
- return self::where('id', '>', 0)->get()->toArray();
- }
- public function projects(){
- return $this->hasOne(Project::class,'id','project_id');
- }
- public function user(){
- return $this->hasOne(User::class,'id','confirmation_user_id');
- }
- public function device()
- {
- return $this->hasOne(Device::class,'id','device_id');
- }
- public function device_name()
- {
- return $this->hasOne(DeviceName::class,'id','device_name_id');
- }
- public function spec()
- {
- return $this->hasOne(Spec::class,'id','spec_id');
- }
- }
|