Ken 2 tygodni temu
rodzic
commit
a6c8649a26
2 zmienionych plików z 6 dodań i 2 usunięć
  1. 1 1
      app/Http/Controllers/admin/Bet.php
  2. 5 1
      app/Models/Bet.php

+ 1 - 1
app/Http/Controllers/admin/Bet.php

@@ -34,7 +34,7 @@ class Bet extends Controller
             $limit = request()->input('limit', 10);
 
             $query = BetModel::where(BetService::getWhere($params))
-                ->with(['user']);
+                ->with(['user','issue']);
 
 
             if (isset($params['username']) && !empty($params['username'])) {

+ 5 - 1
app/Models/Bet.php

@@ -11,11 +11,15 @@ class Bet extends BaseModel
     const STATUS_SETTLED = 2;
     const STATUS_CANCEL = 3;
 
+    function issue()
+    {
+        return $this->belongsTo(Issue::class, 'issue_no', 'issue_no');
+    }
 
     public function user()
     {
         return $this->belongsTo(User::class, 'member_id', 'member_id')
-        ->select(['id','member_id','username','first_name']);
+            ->select(['id', 'member_id', 'username', 'first_name']);
     }