From 0b065a35e8e301bb37302d87da93ce5b05663216 Mon Sep 17 00:00:00 2001 From: shuixiang Date: Fri, 10 Sep 2021 15:13:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/WorkorderController.php | 4 +- .../Controllers/WorkorderController.php | 4 +- .../Controllers/WorkorderController.php | 4 +- app/Models/Agent.php | 5 +++ app/Models/Guide.php | 5 +++ app/Models/Supplier.php | 5 +++ ...21_09_10_144727_update_workorder_table.php | 40 +++++++++++++++++++ 7 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 database/migrations/2021_09_10_144727_update_workorder_table.php diff --git a/app/AdminAgent/Controllers/WorkorderController.php b/app/AdminAgent/Controllers/WorkorderController.php index ebf7df3..f3d6823 100755 --- a/app/AdminAgent/Controllers/WorkorderController.php +++ b/app/AdminAgent/Controllers/WorkorderController.php @@ -46,7 +46,7 @@ class WorkorderController extends AdminController $arr = [ 'workorder_id' => $v->id, 'unread' => true, - 'avatar' => $v->publisher_type == DemandTraits::$col[0] ? $v->point->avatar : $v->publisher->avatar, + 'avatar' => Storage::url($v->publisher_type == DemandTraits::$col[0] ? $v->point->avatar : $v->publisher->avatar), 'name' => $v->publisher_type == DemandTraits::$col[0] ? $v->point->name : $v->publisher->name, 'content' => $v->title, 'last_message' => $item ? ($item->type == 1 ? $item->content : '【 图片 】') : '', @@ -64,7 +64,7 @@ class WorkorderController extends AdminController $arr = [ 'type' => $v->publisher_type == DemandTraits::$col[0] ? 'my' : 'op', 'it_type' => $v->type, - 'avatar' => $v->publisher->avatar, + 'avatar' => Storage::url($v->publisher->avatar), 'name' => $v->publisher->name, 'content' => $v->content, 'created_at_text' => $v->created_at, diff --git a/app/AdminGuide/Controllers/WorkorderController.php b/app/AdminGuide/Controllers/WorkorderController.php index 8fef312..8948dcb 100755 --- a/app/AdminGuide/Controllers/WorkorderController.php +++ b/app/AdminGuide/Controllers/WorkorderController.php @@ -46,7 +46,7 @@ class WorkorderController extends AdminController $arr = [ 'workorder_id' => $v->id, 'unread' => true, - 'avatar' => $v->publisher_type == DemandTraits::$col[2] ? $v->point->avatar : $v->publisher->avatar, + 'avatar' => Storage::url($v->publisher_type == DemandTraits::$col[2] ? $v->point->avatar : $v->publisher->avatar), 'name' => $v->publisher_type == DemandTraits::$col[2] ? $v->point->name : $v->publisher->name, 'content' => $v->title, 'last_message' => $item ? ($item->type == 1 ? $item->content : '【 图片 】') : '', @@ -64,7 +64,7 @@ class WorkorderController extends AdminController $arr = [ 'type' => $v->publisher_type == DemandTraits::$col[2] ? 'my' : 'op', 'it_type' => $v->type, - 'avatar' => $v->publisher->avatar, + 'avatar' => Storage::url($v->publisher->avatar), 'name' => $v->publisher->name, 'content' => $v->content, 'created_at_text' => $v->created_at, diff --git a/app/AdminSupplier/Controllers/WorkorderController.php b/app/AdminSupplier/Controllers/WorkorderController.php index c978ff3..1c5e4ff 100755 --- a/app/AdminSupplier/Controllers/WorkorderController.php +++ b/app/AdminSupplier/Controllers/WorkorderController.php @@ -46,7 +46,7 @@ class WorkorderController extends AdminController $arr = [ 'workorder_id' => $v->id, 'unread' => true, - 'avatar' => $v->publisher_type == DemandTraits::$col[1] ? $v->point->avatar : $v->publisher->avatar, + 'avatar' => Storage::url($v->publisher_type == DemandTraits::$col[1] ? $v->point->avatar : $v->publisher->avatar), 'name' => $v->publisher_type == DemandTraits::$col[1] ? $v->point->name : $v->publisher->name, 'content' => $v->title, 'last_message' => $item ? ($item->type == 1 ? $item->content : '【 图片 】') : '', @@ -64,7 +64,7 @@ class WorkorderController extends AdminController $arr = [ 'type' => $v->publisher_type == DemandTraits::$col[1] ? 'my' : 'op', 'it_type' => $v->type, - 'avatar' => $v->publisher->avatar, + 'avatar' => Storage::url($v->publisher->avatar), 'name' => $v->publisher->name, 'content' => $v->content, 'created_at_text' => $v->created_at, diff --git a/app/Models/Agent.php b/app/Models/Agent.php index 1cdb5a0..e6841df 100644 --- a/app/Models/Agent.php +++ b/app/Models/Agent.php @@ -43,4 +43,9 @@ class Agent extends BaseModel { return $this->morphOne('App\Models\DemandBidding', 'biddingUser'); } + + public function workoorderitem() + { + return $this->morphOne('App\Models\WorkorderItem', 'publisher'); + } } diff --git a/app/Models/Guide.php b/app/Models/Guide.php index 310ea5d..374795c 100644 --- a/app/Models/Guide.php +++ b/app/Models/Guide.php @@ -31,4 +31,9 @@ class Guide extends BaseModel { return $this->morphOne('App\Models\DemandBidding', 'biddingUser'); } + + public function workoorderitem() + { + return $this->morphOne('App\Models\WorkorderItem', 'publisher'); + } } diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php index f4a2a9e..24e6b60 100644 --- a/app/Models/Supplier.php +++ b/app/Models/Supplier.php @@ -48,4 +48,9 @@ class Supplier extends BaseModel { return $this->morphOne('App\Models\Workorder', 'point'); } + + public function workoorderitem() + { + return $this->morphOne('App\Models\WorkorderItem', 'publisher'); + } } diff --git a/database/migrations/2021_09_10_144727_update_workorder_table.php b/database/migrations/2021_09_10_144727_update_workorder_table.php new file mode 100644 index 0000000..e10a2e3 --- /dev/null +++ b/database/migrations/2021_09_10_144727_update_workorder_table.php @@ -0,0 +1,40 @@ +text('content')->nullable()->change(); + }); + + Schema::table('workorder_item', function (Blueprint $table) { + $table->text('content')->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('workorder', function (Blueprint $table) { + $table->string('content')->change(); + }); + + Schema::table('workorder_item', function (Blueprint $table) { + $table->string('content')->change(); + }); + } +}