make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); // Force login as the first user (usually admin/owner) Auth::loginUsingId(1); $req = Illuminate\Http\Request::create('/api/reports/investments', 'GET'); $res = app('App\Http\Controllers\ReportController')->getInvestmentReport($req); echo json_encode(json_decode($res->getContent()), JSON_PRETTY_PRINT);