Я пытаюсь получить связанную модель, используя select в текущем запросе, но связанная модель вернула значение null
.Что не так?
Ubuntu 18.04, PHP 7.1, Postgres 11, NGINX, Laravel 5.7
Запрос:
public function datesFind(Request $request)
{
$games = Game::where('date_time_start', '<=', $request->get('date'))->where('date_time_end', '>=', $request->get('date'))
->where('sport_id', $request->get('sport_id'))->with('gameLevel')->get(['id', 'name', 'sport_id', 'date_time_start', 'date_time_end']);
return $games;
}
Результат:
[
{
"id": 135,
"name": "Новая игра",
"sport_id": 3,
"date_time_start": "2019-01-25 00:00:00",
"date_time_end": "2019-02-25 00:00:00",
"game_level": null
},
]