-
Fat Model & Skinny Controller
-
Bus / Job Pattern
- Command Bus > Jobs
- A task take a small unit of work
- NOT return a value
- Further reading: CRUD & CQRS
- Reusable, Skinny Controller as more reusable codes move to Job
- Then use in Job Queue
- Why Jobs?
- Better response to end user
- Heavy job can be delayed
- Don't forget to Log
- Command Bus > Jobs
-
Event / Listener
- Some event happened, multiple listeners to the event
-
Middleware
- Authentication & Authorization always in middleware
-
Mutators / Transformers
- Format a model presentation
- Controller don't need to play with formatting
- Helps in defining API
- Fractal by PHPLeague
-
Specifications
- return true or false
- and() / or()
- chaining
- usually in call in controller
-
Takeaways
- offload things from controllers
- refactor repeated code
- read Laravel docs
Created
February 17, 2017 01:37
-
-
Save nasrulhazim/3af25050ad7c9b8ff953c28b7ee91be9 to your computer and use it in GitHub Desktop.
Dry & Skinny Laravel Application
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment