Ken hace 2 semanas
padre
commit
da4516bdeb
Se han modificado 2 ficheros con 9 adiciones y 0 borrados
  1. 1 0
      app/Http/Controllers/admin/Withdraw.php
  2. 8 0
      app/Models/Withdraw.php

+ 1 - 0
app/Http/Controllers/admin/Withdraw.php

@@ -68,6 +68,7 @@ class Withdraw extends Controller
             $where = WithdrawService::getWhere($params);
             $count = $query->where($where)->count();
             $list = $query->where($where)
+                ->with(['member'])
                 ->orderBy('created_at', 'desc')
                 ->forpage($page, $limit)->get();
             $result = ['total' => $count, 'data' => $list];

+ 8 - 0
app/Models/Withdraw.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace App\Models;
 
 class Withdraw extends BaseModel
@@ -6,4 +7,11 @@ class Withdraw extends BaseModel
 
     protected $table = 'withdraws';
     protected $fillable = ['member_id', 'amount', 'service_charge', 'to_account', 'after_balance', 'address', 'status', 'remark'];
+
+
+    public function member(): \Illuminate\Database\Eloquent\Relations\BelongsTo
+    {
+        return $this->belongsTo(User::class, 'member_id', 'member_id')
+            ->select(['id', 'member_id', 'username', 'first_name']);
+    }
 }