OussamaMater (@oussamamater) 's Twitter Profile
OussamaMater

@oussamamater

I write code.

ID: 2451645306

linkhttps://blog.oussama-mater.tech/ calendar_today18-04-2014 16:40:39

1,1K Tweet

1,1K Takipçi

83 Takip Edilen

OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Use Contextual Attributes You probably had to initialize attributes with config values before. Laravel makes it easier with contextual attributes. You can inject values directly, use constructor property promotion, and skip the boilerplate. It's just elegant 🚀

Laravel Tip 💡: Use Contextual Attributes

You probably had to initialize attributes with config values before. Laravel makes it easier with contextual attributes. You can inject values directly, use constructor property promotion, and skip the boilerplate. It's just elegant 🚀
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Confirm to Proceed Need to confirm before running a command? Laravel ships with the "ConfirmableTrait" for that exactly. Just call "confirmToProceed()" for confirmation, and skip the prompt anytime with the "--force" option 🚀 #laravel

Laravel Tip 💡: Confirm to Proceed

Need to confirm before running a command? Laravel ships with the "ConfirmableTrait" for that exactly. Just call "confirmToProceed()" for confirmation, and skip the prompt anytime with the "--force" option 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Real-Time Download Progress If you ever need to download a file in your Laravel app, consider using Guzzle's progress option. It gives you real-time updates on the download, which you can broadcast to your UI, display in the console, or handle however you like 🚀

Laravel Tip 💡: Real-Time Download Progress

If you ever need to download a file in your Laravel app, consider using Guzzle's progress option. It gives you real-time updates on the download, which you can broadcast to your UI, display in the console, or handle however you like 🚀
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Display Remaining Attempts for a Rate-Limited Job If you have a rate-limited job that can be dispatched via a UI, you can greatly improve the UX by displaying how many attempts are remaining for the day 🚀 #laravel

Laravel Tip 💡: Display Remaining Attempts for a Rate-Limited Job

If you have a rate-limited job that can be dispatched via a UI, you can greatly improve the UX by displaying how many attempts are remaining for the day 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Record API Responses as Fixtures If you are testing your API integrations (which you should) you are probably using the "fake()" method. To quickly prepare a stub for testing, you can use the "sink()" method to save the response into a fixture 🚀 #laravel

Laravel Tip 💡: Record API Responses as Fixtures

If you are testing your API integrations (which you should) you are probably using the "fake()" method. To quickly prepare a stub for testing, you can use the "sink()" method to save the response into a fixture 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: The "forelse" Blade Directive When looping over a collection, you have probably checked its count first to handle the empty state. But the "forelse" Blade directive has existed forever, and it does exactly that, elegantly 🚀 #laravel

Laravel Tip 💡: The "forelse" Blade Directive

When looping over a collection, you have probably checked its count first to handle the empty state. But the "forelse" Blade directive has existed forever, and it does exactly that, elegantly 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Encrypt Your Jobs If you are working with sensitive jobs, you can instruct Laravel to encrypt the payload by using the "ShouldBeEncrypted" interface. How cool is this? 🚀 #laravel

Laravel Tip 💡: Encrypt Your Jobs

If you are working with sensitive jobs, you can instruct Laravel to encrypt the payload by using the "ShouldBeEncrypted" interface. How cool is this? 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Global Middleware for Jobs Did you know you can apply global job middleware? It can be really useful for custom logging and monitoring, like instantly notifying Slack or Discord about slower-than-usual jobs 🚀 #laravel

Laravel Tip 💡: Global Middleware for Jobs

Did you know you can apply global job middleware? It can be really useful for custom logging and monitoring, like instantly notifying Slack or Discord about slower-than-usual jobs 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Clamp Numbers Have you ever needed to keep a number within a specific range, like a rating or a computed value? While you can hack your way through with min and max, Laravel ships with an elegant helper "clamp" to do exactly that 🚀 #laravel

Laravel Tip 💡: Clamp Numbers

Have you ever needed to keep a number within a specific range, like a rating or a computed value? While you can hack your way through with min and max, Laravel ships with an elegant helper "clamp" to do exactly that 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Select Sub-Arrays There will be times when you need to extract a sub-array from the main one, whether it's from a JSON response, your models, or whatever. While you could use map for that, Laravel ships with a much more elegant helper, "select", just for this 🚀

Laravel Tip 💡: Select Sub-Arrays

There will be times when you need to extract a sub-array from the main one, whether it's from a JSON response, your models, or whatever. While you could use map for that, Laravel ships with a much more elegant helper, "select", just for this 🚀
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Date Checks with Carbon I know you've had to check if a date has expired or is in the future at least once. Since Laravel uses Carbon under the hood, you've got access to a ton of helpers to handle all that elegantly 🚀 #laravel

Laravel Tip 💡: Date Checks with Carbon

I know you've had to check if a date has expired or is in the future at least once. Since Laravel uses Carbon under the hood, you've got access to a ton of helpers to handle all that elegantly 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

It's been a while since I wrote an article, so here is one about boosting Laravel Boost. blog.oussama-mater.tech/laravel-boost/

OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Generate Realistic Test Sentences Since Laravel uses FakerPHP under the hood, you can use "realText" to generate more realistic sentences for your tests instead of predictable dummy ones 🚀 #laravel

Laravel Tip 💡: Generate Realistic Test Sentences

Since Laravel uses FakerPHP under the hood, you can use "realText" to generate more realistic sentences for your tests instead of predictable dummy ones 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: The "use" Blade Directive We have all probably used an enum in Blade at some point. While you can drop in raw PHP, Laravel v10 and upward have the "use" directive for exactly this 🚀 #laravel

Laravel Tip 💡: The "use" Blade Directive

We have all probably used an enum in Blade at some point. While you can drop in raw PHP, Laravel v10 and upward have the "use" directive for exactly this 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: Boot Traits with Attributes Bootable traits are great, but their naming convention can be painful. Since Laravel v12.22, you can fully customize method names using PHP attributes 🚀 #laravel

Laravel Tip 💡: Boot Traits with Attributes

Bootable traits are great, but their naming convention can be painful. Since Laravel v12.22, you can fully customize method names using PHP attributes 🚀

#laravel
OussamaMater (@oussamamater) 's Twitter Profile Photo

Laravel Tip 💡: The New "whereAttachedTo" Method We have all used "whereHas", and sometimes you need to constrain it to match specific models. Since Laravel v12.13, you can use "whereAttachedTo" for exactly that 🚀 #laravel

Laravel Tip 💡: The New "whereAttachedTo" Method 

We have all used "whereHas", and sometimes you need to constrain it to match specific models. Since Laravel v12.13, you can use "whereAttachedTo" for exactly that 🚀

#laravel