jenssegers / jenssegers/model

Static API class implementation

Open
#40 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
394
Forks
59
PR merge metrics
No merged PRs in 30d

Description

Your example is that of a static API class: `API::post('/items', $this->attributes);`.

Currently, my custom API client is injected into my controller and not static. This allows me to authenticate in the constructor and call the API from the controller's instance.

I would like to use this package to define a model for the controller to use instead. However, being new to Laravel and assuming I cannot inject my API Client into my model, I tried to convert it to a static class. However, it seems to me this would mean I would need to run the authentication for every call. Though, thinking about this out loud, perhaps I can store the token in session.

Any thoughts on this? Am I missing something obvious?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.