Skip to content

Static API class implementation #40

@jcandan

Description

@jcandan

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions