Laravel Model Casts: Making Data Types Not Suck ๐ฏ
Stop manually converting JSON strings and dates! Laravel's model casts handle data transformation automatically. Let me show you the magic I wish I knew 5 years ago.
26 articles tagged with "php"
Stop manually converting JSON strings and dates! Laravel's model casts handle data transformation automatically. Let me show you the magic I wish I knew 5 years ago.
Your database isn't a file cabinet! Learn how to handle file uploads like a pro, from local storage to S3, without blowing up your server.
That 'fast' local app that takes 10 seconds in production? Spoiler: It's N+1 queries. Here's how I hunted them down and made our API 50x faster.
Your database is crying. Every page load = 47 queries. Let me show you how caching saved our production API from melting down and cut response times by 80%.
Stop putting authorization logic everywhere! Let's use Laravel Policies and Gates to keep your code clean and your users in their lane.
Stop manually creating test data like a caveman! Learn how I use Model Factories and Seeders to spin up realistic databases in seconds - the same patterns we use in production at Cubet.
Want to add custom methods to Laravel's core classes without touching framework code? Macros are your secret weapon. Here's how I've used them in production to keep code DRY.
Your database stores 'john_doe' but you need 'John Doe'? Let Laravel do the heavy lifting automatically!
If you're copy-pasting the same WHERE clauses everywhere, Laravel scopes are about to change your life. Clean, reusable query filters that actually make sense!
Tired of Vue/React complexity? Livewire lets you build reactive UIs with pure PHP. It's like magic, but real!
Stop cluttering your controllers! Let Laravel Observers watch your models and handle side effects like a ninja. Clean code incoming!
Stop returning raw Eloquent models in your API! Learn how Laravel API Resources make your JSON responses clean, consistent, and actually maintainable.
Your database is a hot mess because you're not using transactions. Let's fix that before your users notice!
Sending emails, SMS, Slack messages, and push notifications with one simple API. Laravel notifications make messaging so easy, you'll wonder why you ever wrote custom mailers!
Still copying the same HTML in 20 different files? Let me introduce you to Blade Components - Laravel's secret weapon for clean, reusable UI code!
Still writing User::findOrFail($id) in every controller? Laravel's route model binding will make you feel like you've discovered fire!
Your controllers look like spaghetti? Events and Listeners will save your sanity and make your code so clean you'll cry tears of joy!
Your users are staring at loading spinners while you send emails? Let's fix that with Laravel queues - the secret weapon for background tasks!
Still using foreach everywhere? Laravel Collections will blow your mind and make your code so clean you'll want to frame it!
Think you know Eloquent relationships? These advanced tricks will change how you query your database forever!
Think dependency injection is scary? Laravel's Service Container makes it so easy, you'll wonder why you ever used 'new' everywhere!
Stop fighting with your database relationships! Here's how to use Eloquent like a pro (without the headaches).
Middleware is like having a bouncer at your app's door. Let's learn how to use it without getting kicked out!
Testing doesn't have to be boring! Here's how to write Laravel tests that actually save your bacon (and your sanity).
Stop terrorizing your users with cryptic error messages! Here's how to write Laravel validation that's actually... helpful.
Your Laravel app is slow? Let's fix that! Here are 5 simple tricks that actually work (no PhD required).