Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component functions for REST API and GraphQL #564

Open
xmelic8 opened this issue Aug 23, 2024 · 3 comments
Open

Component functions for REST API and GraphQL #564

xmelic8 opened this issue Aug 23, 2024 · 3 comments

Comments

@xmelic8
Copy link
Contributor

xmelic8 commented Aug 23, 2024

Transitioning to Laravel Auth is great. However, implementing functions directly into components is unfortunate. These functions can't be used when creating REST API and GraphQL interfaces, which leads to unnecessary duplication of logic.

Wouldn't it be better to separate the logic common to components and APIs into a separate class? For example, password reset requests use PasswordBroker. The User class implements a trait with the function sendPasswordResetNotification(). Although there is a setUrlForPasswordReset() function available, I don't see a way to call it if I want to use REST API and don't have a resetPassword component in the CMS. I would also prefer to send the email through the queue. But how can I override the sendPasswordResetNotification function in this trait?

@daftspunk
Copy link
Member

daftspunk commented Aug 26, 2024

Good points, @xmelic8. Thank you!

@xmelic8
Copy link
Contributor Author

xmelic8 commented Aug 26, 2024

Is there a plan to implement these changes in the near future versions? Or should I create a fork, make the changes, and submit pull requests for testing?

@daftspunk
Copy link
Member

Yes, please. Then we can make a new release for it alongside #565

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants