Closed glennjacobs closed 3 years ago
Hi π
Personally, I like to break my app
folder into little modules that each have their own Actions
folder.
However, even if you stick to the default app/Actions
structure, I don't feel like it's too much of a problem. Ultimately you can create actions without Laravel Actions on this folder and only add the AsAction
trait whenever your need to use its features. So semantically, as long as classes inside the app/Actions
are here to perform one task, it doesn't matter too much whether it uses the AsAction
trait or not. That's my opinion anyway. π
Thanks, always interesting to hear different developer's approaches. I'm tempted to make a single folder for the business logic and then split that into sub-folders for the different app modules, which as you say can contain an Actions folder.
Yeah that works too. π
I might write a little article about it at some point. What we did for Octohook for example is we put all the framework stuff in app/Core
β e.g. providers, kernels, helpers, exception handler, etc. Then we created one folder per module. For example, we have app/Authentication
(containing the User model and actions to login/register), app/TeamManagement
(containing the Team model, the invitation logic, etc.), app/Billing
(containing the Subscription model and the integration with Paddle), app/Webhooks
, app/Workflows
, and so on.
Each of these modules contains a Models
and an Actions
directory.
So far Iβm pretty happy with this approach to be honest. I hope this helps. βΊοΈ
Any opinions on how to structure a Laravel app that uses Fortify and Jetstream? They now put their "actions" into the
app/Actions
folder and I felt this might be a little confusing to use the same folder.Would you move the Fortify/Jetsteam actions to another folder perhaps?