Godfred Boateng Addai (@godfredcs) header
Godfred Boateng Addai (@godfredcs) profile picture

Software Engineer

Berlin, Germany
Joined July 2013
Photo by Godfred Boateng Addai (@godfredcs)Photo by Godfred Boateng Addai (@godfredcs)Photo by Godfred Boateng Addai (@godfredcs)Photo by Godfred Boateng Addai (@godfredcs)Photo by Godfred Boateng Addai (@godfredcs)Photo by Godfred Boateng Addai (@godfredcs)Photo by Godfred Boateng Addai (@godfredcs)Photo by Godfred Boateng Addai (@godfredcs)Photo by Godfred Boateng Addai (@godfredcs)
Godfred Boateng Addai retweeted
Finger counting in binary:
21
16
8
243
27,483
Godfred Boateng Addai retweeted
In most cases, this is a very good reason not to use auth()->user() inside actions or services. Business logic (Actions and services) Are usually called from both the http layer and cli layer. It will be better to inject a user model which then fixes this problem. Controllers can get auth user, console commands can fetch the required user then jobs, services or actions don't need to be tied to the auth session.
1
1
3
67
Godfred Boateng Addai retweeted
Laravel just destroyed your....N+1 problem. πŸ’£
10
50
2
408
25,415
Godfred Boateng Addai retweeted
Sometimes we may want to do some post processing of response or track some instrumentation metrics (e.g. saving transactions in NewRelic) but these can increase our response time which is not good for our users. Terminable middlewares allows you to do this even after response is sent to the user.
1
5
9
2,101
Godfred Boateng Addai retweeted
Did you know that PHP reconnects to Redis on every request? Laravel 12 introduces a new env variable REDIS_PERSISTENT that can maintain Redis connections between requests. Soon, I'll write a blog article diving deeper into this topic.
11
39
4
517
38,035
Godfred Boateng Addai retweeted
Replying to @PovilasKorop
Don't overthink performance and abstractions especially in small projects. Grow with the project. Keep It Simple, Stupid - KISS. Understandable code is better than shiny new tricks. Always be ready to learn, don't let your ego lead the way.
3
12
514
Godfred Boateng Addai retweeted
I remember I had to also find out the hard way myself, sometimes choosing the right ID type is not really given the right attention from the start. Read about how I choose the right databse key depending on the service: Link below.
UUIDs are not great, and they are not sortable. Learned the hard way.
1
3
1
3
2,500
Godfred Boateng Addai retweeted
πŸ‘‡
I remember I had to also find out the hard way myself, sometimes choosing the right ID type is not really given the right attention from the start. Read about how I choose the right databse key depending on the service: Link below.
2
3
1,686
Godfred Boateng Addai retweeted
The perfect stack doesn't exist...
90
93
13
2,446
402,682
Godfred Boateng Addai retweeted
πŸ’‘A quick Eloquent Tip Laravel 8 introduced the Prunable trait. You can use it to delete old models on a scheduled basis. You don't need to write custom commands anymore:
6
43
3
275
17,959
Godfred Boateng Addai retweeted
πŸš€ Laravel Tip: Laravel provides a readable Sleep class for precise time management in your code! ⏳ Explore these convenient methods for pauses and delays, perfect for testing and managing asynchronous tasks. πŸ‘©β€πŸ’»πŸ’‘ #Laravel #php
3
26
96
4,916
Godfred Boateng Addai retweeted
Laravel Insider πŸ‘€ We might get a new Number utility class for formatting numbers. What are your thoughts? There is an active PR by @CodeWithCaen that adds this helper and the initial idea was even endorsed by Taylor
18
27
2
248
30,275
Godfred Boateng Addai retweeted
These days I'm using #Eloquent's touch() more often for simple timestamp updates than the regular update([...]) method. πŸ‘€
2
18
145
9,343
Godfred Boateng Addai retweeted
#Laravel Tip You may use the `push` method to save both model & it's relationship. For more: hamidafghan.me/blog/laravel-…
4
42
2
259
16,295
Godfred Boateng Addai retweeted
Which approach do you prefer using in your Laravel apps? πŸ€” I like using "whereKey"! #laravel #php
31
22
5
243
36,022
Godfred Boateng Addai retweeted
A new "ensure" method on collections may now be used to ensure that all elements of the collection are of a given type. Otherwise, an UnexpectedValueException will be thrown. 🚨 Thanks @inxilpro!
10
59
8
544
38,982
Godfred Boateng Addai retweeted
Laravel devs, if you're generating reports that you don't need to keep here are a couple of approaches I've used to get rid of them.
4
26
121
10,022
Godfred Boateng Addai retweeted
πŸ’‘ Pro Laravel Tip: Supercharge your pagination in Laravel with onEachSide()! πŸš€ Take control of your pagination window in Laravel using onEachSide()! 🌐πŸ”₯ Maximize usability and aesthetics by adjusting the value. Experiment and find the perfect balance 🧐🧐 #laravel #php 🫢πŸͺ„
4
26
1
107
7,075
Godfred Boateng Addai retweeted
#Laravel Tip: You can keep a check on performance leaks during development, using laravel's Strict Mode. It was introduced in Laravel 9.
18
81
7,351