@@ -17,7 +17,7 @@ class SportGame extends Controller
public function list()
{
try {
- $list = SportGameModel::with(['children'])->field('id,name,name_en,end_time,is_locked')->get()->toArray();
+ $list = SportGameModel::with(['children'])->select(['id','name','name_en','end_time','is_locked'])->get()->toArray();
} catch (Exception $e) {
return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
}
@@ -1,9 +1,15 @@
<?php
namespace App\Models;
+use App\Models\SportGameplay;
class SportGame extends BaseModel
protected $table = 'sport_game';
protected $fillable = [ 'name', 'name_en', 'end_time','is_locked'];
+
+ public function children()
+ {
+ return $this->hasMany(SportGameplay::class, 'game_id', 'id')->select(['id','game_id','name','name_en','is_locked', 'odds','mininum', 'maxinum']);
+ }