Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
李可松 4 years ago
parent
commit
9b31be4fb0
  1. 3
      app/AdminAgent/Controllers/WorkorderController.php
  2. 5
      app/Models/Workorder.php
  3. 6
      app/Models/WorkorderItem.php

3
app/AdminAgent/Controllers/WorkorderController.php

@ -151,7 +151,7 @@ class WorkorderController extends AdminController
return $this->error('上传图片格式错误'); return $this->error('上传图片格式错误');
} }
$path = $request->image->store('images/workorder');
$path = $request->image->store('public/images/workorder');
return $this->jsonSuccess(['path' => config('filesystems.disks.public.url') . '/' . $path]); return $this->jsonSuccess(['path' => config('filesystems.disks.public.url') . '/' . $path]);
} }
@ -190,6 +190,7 @@ class WorkorderController extends AdminController
return $this->jsonFailValidated('数据不全:'.$validator->errors()->first()); return $this->jsonFailValidated('数据不全:'.$validator->errors()->first());
} }
$data = WorkorderItem::query() $data = WorkorderItem::query()
->with('publisher')
->where('workorder_id',request('workorder_id',0)) ->where('workorder_id',request('workorder_id',0))
->orderBy('created_at') ->orderBy('created_at')
->get(); ->get();

5
app/Models/Workorder.php

@ -22,4 +22,9 @@ class Workorder extends Model
{ {
return $this->morphTo(); return $this->morphTo();
} }
public function items()
{
return $this->hasMany(WorkorderItem::class,'workorder_id','id');
}
} }

6
app/Models/WorkorderItem.php

@ -12,5 +12,9 @@ class WorkorderItem extends Model
use SoftDeletes; use SoftDeletes;
protected $table = 'workorder_item'; protected $table = 'workorder_item';
public function publisher()
{
return $this->morphTo();
}
} }
Loading…
Cancel
Save