I call to controller index using ajax,
Controller:
public function index(Request $request)
{
if ($request->ajax()) {
$client = Clients::with('support', 'domains', 'projects')
->find($request->client_id);
return response()
->json([$client->domains, $client->projects], 200);
}
$domains = Domains::all();
$domainsCount = $domains->count();
return view('domains.index', [
'domains' => $domains,
'domainsCount' => $domainsCount
]);
}
{message: "Attempt to assign property 'debug' of non-object", exception: "ErrorException",…}
exception: "ErrorException"
file: "/var/www/xxxx/vendor/lanin/laravel-api-debugger/src/Debugger.php"
line: 118
message: "Attempt to assign property 'debug' of non-object"
trace: [{file: "/var/www/xxx/vendor/lanin/laravel-api-debugger/src/Debugger.php", line: 118,…},…]
0: {file: "/var/www/xxx/vendor/lanin/laravel-api-debugger/src/Debugger.php", line: 118,…}
class: "Illuminate\Foundation\Bootstrap\HandleExceptions"
file: "/var/www/xxx/vendor/lanin/laravel-api-debugger/src/Debugger.php"
function: "handleError"
line: 118
type: "->"
1: {file: "/var/www/xxx/vendor/lanin/laravel-api-debugger/src/Debugger.php", line: 43,…}
class: "Lanin\Laravel\ApiDebugger\Debugger"
file: "/var/www/xxx/vendor/lanin/laravel-api-debugger/src/Debugger.php"
function: "updateResponse"
line: 43
type: "->"
2: {file: "/var/www/xxx/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php", line: 360,…}
class: "Lanin\Laravel\ApiDebugger\Debugger"
file: "/var/www/xxx/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php"
function: "Lanin\Laravel\ApiDebugger{closure}"
line: 360
type: "->"
3: {file: "/var/www/xxx/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php", line: 209,…}
class: "Illuminate\Events\Dispatcher"
file: "/var/www/xxx/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php"
function: "Illuminate\Events{closure}"
line: 209
type: "->"
4: {file: "/var/www/xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", line: 128,…}
class: "Illuminate\Events\Dispatcher"
file: "/var/www/xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php"
function: "dispatch"
line: 128
type: "->"
5: {file: "/var/www/xxx/public/index.php", line: 55, function: "handle",…}
class: "Illuminate\Foundation\Http\Kernel"
file: "/var/www/xxx/public/index.php"
function: "handle"
line: 55
type: "->"
Console error:
GET http://domain.com/domains?client_id=1 500 (Internal Server Error)
What is the mistake I have done?