@signalwarrant Just pass it like any other view data?
$response = new iRacing(env('EMAIL'), env('PASSWORD'));
$yearlyStats = $response->stats->member_yearly();
return view('some.view', ['yearlyStats' => $yearlyStats]);
Also, you shouldn’t be using env outside of configuration files. And it’s probably better to bind an instance of that class to the container so you can inject it where you need, instead of manually instantiating it everywhere you’re going to use it:
$this->app->singleton(iRacing::class, function () {
return new iRacing($this->app['config']['services.iracing.email'], $this->app['config']['services.iracing.password']);
});
class DataController extends Controller
{
protected $service;
public function __construct(iRacing $service)
{
$this->service = $service;
}
public function memberYearly()
{
return view('some.view', [
'yearlyStats' => $this->service->states->member_yearly(),
]);
}
}