Невозможно найти JSON: в ответе JSON: [{& quot; статус & quot ;: & quot; ОК & quot ;, & quot; данные & quot ;: []}]

У меня есть эта функция вернуть это

return response()->json([

'status' => 'OK',

'data' => $locations,

]);

Я должен проверить это, я попробовал это

public function testGetAjax()

{

$client = Client::where('id', $this->user->client_id)->first();//client_id =15

$clientProfile = ClientProfile::where('client_id', $this->user->client_id)->first();//$clientProfile->id 338$profileLocation=ProfileLocation::where('profile_id',$clientProfile->id)->first();//$profileLocation->id 1534

$locations=Location::where('id',$profileLocation->location_id)->get()->all(); //location->id=376

$this->actingAs($this->user);

$response=$this->json('GET',(route('AjaxLocations',[$client->alias,$clientProfile->id])),$locations)

->assertStatus(200);

$response->assertJson([

"status" => "OK",

"data" => $locations

]);}

Но я получил эту ошибку -> Невозможно найти JSON:

и данные пусты

в ответе JSON: [{«status»: «OK», «data»: []}].

Как я могу это исправить? Как я могу отправить $ местоположения, чтобы данные не были пустыми !!

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector