OussamaMater Profile Banner
OussamaMater Profile
OussamaMater

@OussamaMater

Followers
1,553
Following
82
Media
264
Statuses
863
Explore trending content on Musk Viewer
@OussamaMater
OussamaMater
1 month
Laravel Tip💡: Generated Columns Did you know that Laravel can handle generated columns in migrations out of the box? No need to write raw SQL in your migration to create these columns 🚀 #laravel
Tweet media one
9
44
316
@OussamaMater
OussamaMater
27 days
Laravel Tip 💡: The Conditionable Trait Do you write multiple "if" statements to call different methods in a class? Consider making your class "conditionable" by using Laravel's "Conditionable" trait 🚀 #laravel
Tweet media one
10
32
261
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: Spell Numbers Did you know that you can spell numbers in different locales using the "Number" helper that Laravel ships with? 🚀 #laravel
Tweet media one
5
44
241
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Ensure Env Keys Exist If you want to be absolutely sure that a key exists in your .env file, use the "getOrFail()" method. It will throw a runtime exception if the key is missing. This is really useful for API keys 🚀 #laravel
Tweet media one
7
49
240
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Prevent N+1 Issues Eager loading can significantly improve performance. Use the "preventLazyLoading" method to ensure all relationships are eager-loaded during development and customize its behavior for violations 🚀 #laravel
Tweet media one
4
41
241
@OussamaMater
OussamaMater
7 months
Laravel Tip💡: The "toQuery" method Did you know that Laravel ships with a method called "toQuery"? This method allows you to update a collection using a single query statement by running a "whereIn" 🚀 #laravel #php
Tweet media one
10
54
235
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: The "literal" Helper Did you know that Laravel ships with a cool helper "literal" that allows you to create a PHP object using named arguments? 🚀 #laravel
Tweet media one
3
35
212
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: Hash Passwords Automatically When creating users, we often use the Hash facade, but did you know that Laravel comes with a "hashed" cast that will automatically hash your user's password? 🚀 #laravel
Tweet media one
7
31
203
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Abbreviate Numbers Did you know that Laravel ships with the "abbreviate" method, which allows you to format numbers in a human-readable way with an abbreviation for the units? 🚀 #laravel
Tweet media one
3
31
197
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Formatting to Percentages Did you know Laravel ships with a "percentage" helper to get the percentage of any representative value? 🚀 #laravel
Tweet media one
2
27
186
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Validate Dates Elegantly Did you know that when validating dates with Laravel, you can pass strings like "today" or "tomorrow" instead of actual dates? This makes the validation rules much more readable 🚀 #laravel
Tweet media one
0
30
182
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Cache Headers On The Fly Did you know that Laravel ships with a middleware "SetCacheHeaders", which you can use to set cache headers, such as "max_age" and "etag"? 🚀 #laravel
Tweet media one
4
23
177
@OussamaMater
OussamaMater
6 months
Laravel Tip💡: Avoid Columns Ambiguity I'm sure we've all encountered column name ambiguity when building queries at least once. To avoid that, you can use the "qualifyColumn" method, which prefixes the column with the table name 🚀 #laravel
Tweet media one
2
43
170
@OussamaMater
OussamaMater
5 months
Laravel Tip💡: Clone Your Queries Sometimes you may need to reuse the same base query for multiple filterings. Laravel ships with a "clone" method to do exactly that 🚀 #laravel
Tweet media one
3
24
164
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Unique Request Identifiers Have you ever needed to code a unique identifier for a request, such as for caching purposes? Laravel ships with the "fingerprint" method that allows you to generate a unique identifier for your requests 🚀 #laravel
Tweet media one
4
28
162
@OussamaMater
OussamaMater
1 month
Laravel Tip 💡: Exclude Validated Input Sometimes, you may want to exclude an input from the validated array. Instead of manually unsetting it, you can use the "exclude" rule, which does exactly that 🚀 #laravel
Tweet media one
0
19
143
@OussamaMater
OussamaMater
1 month
Laravel Tip 💡: Filter Only Real Emails Tired of high bounce rates from invalid emails? Laravel ships with the "dns" validation rule to ensure you get real emails. It won't magically fix the issue, but it definitely improves deliverability 🚀 #laravel
Tweet media one
2
32
148
@OussamaMater
OussamaMater
14 days
Laravel Tip 💡: The "tap" Helper How many times have you needed to return an object right after a basic action? Yes, many times I know. The "tap" helper allows you to do just that 🚀 #laravel
Tweet media one
7
14
136
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Check If Your Model Has Changed Since Last Retrieval Did you know Laravel ships with the `isDirty()` method, which allows you to check if one or more attributes have changed since the last time you retrieved the model? 🚀 #laravel
Tweet media one
2
14
134
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: Send Concurrent Requests Laravel's HTTP client wraps Guzzle, which allows you to make concurrent requests to speed things up. This is very helpful for various cases, such as health checks! 🚀 #laravel
Tweet media one
2
22
128
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Shape Your Strings Since Laravel uses FakerPHP for generating fake data, you can use "lexify" to generate strings in a specific pattern 🚀 #laravel
Tweet media one
2
28
130
@OussamaMater
OussamaMater
1 month
Laravel Tip 💡: Use Default Models When working with "hasOne" or "belongsTo" relationships, we often check whether they are nullable before accessing their properties. In such cases, you can use default models and be sure you will never get null values 🚀 #larave
Tweet media one
8
22
126
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: The "latest" and "oldest" Methods We often order models in ascending or descending order using the "orderBy" method. But did you know that Laravel comes with two methods, "latest" and "oldest," that do exactly that? 🚀 #laravel
Tweet media one
3
17
124
@OussamaMater
OussamaMater
13 days
Laravel Tip 💡: Pass Multiple IDs and Specific Columns to "find" We often use "find()", but did you know you can pass an array of IDs and select specific columns? 🚀 #laravel
Tweet media one
2
20
126
@OussamaMater
OussamaMater
24 days
Laravel Tip 💡: Add Multiple Columns After a Specific Column Did you know that you can add multiple columns after a specific column using the "after" method? 🚀 #laravel
Tweet media one
4
10
121
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Cast Values On The Fly Sometimes you may need to apply casts while executing a query. Luckily, you can do that on the fly with the "withCasts" method that Laravel ships with 🚀 #laravel
Tweet media one
2
14
120
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Time Travel in Your Tests Did you know that Laravel comes with cool time helpers that allow you to travel into the future or the past in your tests? 🚀 #laravel
Tweet media one
2
22
119
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: The "valueOrFail" Method We often use the "firstOrFail" method to get a single value from the resulting model. Did you know that Laravel ships with the "valueOrFail" method, which allows you to do exactly that? 🚀 #laravel
Tweet media one
2
25
118
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Conditionally Adding Rules When working with dynamic forms, you might want to validate certain inputs only if another input is checked. Laravel ships with the "exclude_if" validation rule, which does exactly that 🚀 #laravel
Tweet media one
2
20
116
@OussamaMater
OussamaMater
3 months
Laravel Tip 💡: Log Out Other Devices When users log out, you might want to ask them if they want to log out from other devices while keeping the current one. Luckily, Laravel ships with the "logoutOtherDevices" method that does exactly that. 🚀 #laravel
Tweet media one
2
16
116
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Ping URLs When Running Commands Did you know you can ping URLs before and after your command has run? This is really useful if you want to notify an external service or a webhook. 🚀 #laravel
Tweet media one
3
16
116
@OussamaMater
OussamaMater
5 months
Laravel Tip💡: Schedule Jobs Based On Time Zones Did you know that you can schedule jobs based on specific time zones? You can do so by chaining the "timezone" method 🚀 #Laravel
Tweet media one
4
15
115
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Generate Fake Credit Card Numbers Since Laravel uses FakerPHP under the hood, you can generate fake credit card numbers for your tests 🚀 #laravel
Tweet media one
2
15
115
@OussamaMater
OussamaMater
7 months
Laravel Tip💡: Group Resource Controllers Did you know that you can group resource controllers using the "resources()" method? It makes routing even cleaner! 🚀 #laravel #php
Tweet media one
2
19
111
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: The "createOr" Laravel Sometimes, you may want to execute some actions when no record is found, beyond just creating a new instance. The "createOr" method allows you to do exactly that 🚀 #laravel
Tweet media one
4
17
113
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Invisible Columns If you are using MySQL/MariaDB as your database, you can leverage invisible columns. These columns remain hidden in "SELECT * " statements, which is perfect for handling sensitive information and precomputed columns 🚀 #laravel
Tweet media one
2
16
111
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: The "firstWhere" Method We often need to get the first record matching a where statement. While "where()" combined with "first()" does the job, Laravel ships with a shortcut "firstWhere()" to do exactly that 🚀 #laravel
Tweet media one
2
15
111
@OussamaMater
OussamaMater
3 months
Laravel Tip 💡: Working with Base64 Strings We often work with Base64 strings, especially when building API integrations. Laravel comes with built-in helpers to work with Base64 right out of the box 🚀 #laravel
Tweet media one
1
10
111
@OussamaMater
OussamaMater
1 month
Laravel Tip💡: Get Bearer Tokens Elegantly Building an API with Laravel? You can retrieve the bearer token using the "bearerToken" method on the request object without having to manually parse it 🚀 #laravel
Tweet media one
4
13
110
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Work with IPs Sometimes you may need to work with IP addresses. Laravel uses the HttpFoundation component from Symfony under the hood, which comes with useful IP helpers 🚀 #laravel
Tweet media one
1
18
110
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Exclude Middleware Sometimes you may need to exclude a middleware from a specific route. You can do this using the "withoutMiddleware()" method 🚀 #laravel
Tweet media one
1
22
109
@OussamaMater
OussamaMater
17 days
Laravel Tip 💡: The Pipeline Helper Often, we need to process input through multiple steps, such as applying request filters to a query or cleaning data in a multi-stage chain. When you find yourself in such cases, use Laravel's Pipeline helper 🚀 #laravel
Tweet media one
3
18
108
@OussamaMater
OussamaMater
8 months
Laravel Tip💡: The "foreignIdFor" Method When defining foreign IDs, Laravel offers multiple methods, one of which is "foreignIdFor()". Not only does it make your code more readable, but you can quickly navigate to the model from the migration 🚀 #laravel #php
Tweet media one
5
12
104
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: Check Collection Item Types Sometimes you may want to ensure that the collection items are all of a specific type. While "each()" paired with an "instanceof()" check might do the trick, Laravel already ships with the `ensure` method to do that 🚀 #laravel
Tweet media one
0
20
102
@OussamaMater
OussamaMater
1 month
Laravel Tip 💡: A Better Implode We've all used PHP's "implode" function, but did you know about the "join" helper? It does the same thing but also allows you to customize the last separator 🚀 #laravel
Tweet media one
1
19
104
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Extract Validated Input When working with validated input, we often need to extract only a few items from the request. Instead of manually unsetting or filtering, use Laravel's "safe()" method to do this elegantly 🚀 #laravel
Tweet media one
1
14
103
@OussamaMater
OussamaMater
6 months
Laravel Tip💡: Limit Eager Loaded Relationships In Laravel versions 10 and below, we couldn't limit eager loaded relationships natively. Well, guess what? In Laravel 11, we can! 🚀 #laravel
Tweet media one
2
19
101
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Generate Random Passwords Did you know that Laravel ships with a "password" method that generates random, strong passwords? This is helpful when you want to suggest passwords for your users 🚀 #laravel
Tweet media one
3
9
101
@OussamaMater
OussamaMater
29 days
Laravel Tip 💡: Bulk Dispatch While Laravel offers batches to dispatch jobs, sometimes you just want to fire and forget. In that case, you can dispatch the jobs in bulk instead of individually 🚀 #laravel
Tweet media one
4
22
101
@OussamaMater
OussamaMater
28 days
Laravel Tip 💡: Safer Passwords for Users Users tend to use the same password for all websites, which puts them in danger if their password has been leaked. You can make sure that the user inputs an uncompromised password using the "uncompromised" rule 🚀 #laravel
Tweet media one
1
13
98
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Magic Factories Methods We use factories a lot. Did you know about the "for[Relation]" and "has[Relation]" magic methods? You just need to make sure you have the relationship set up in your model and you are good to go 🚀 #laravel
Tweet media one
1
17
99
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: Skip Collection Items Until a Condition is Met Sometimes, when working with collections, you may want to skip all the elements until a condition is met. Laravel comes with the "skipUntil" method to do exactly that 🚀 #laravel
Tweet media one
0
18
99
@OussamaMater
OussamaMater
26 days
Laravel Tip 💡: Run Seeders During Tests Did you know you can run database seeders from within your tests? This allows you to keep your tests clean by moving setup logic to seeders 🚀 Test is written in @pestphp 🔥 #laravel
Tweet media one
2
14
98
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: The New "chopStart" and "chopEnd" Methods Laravel 11.14 introduces 2 new string helpers that allow you to remove characters from the beginning or end of a string 🚀 #laravel
Tweet media one
0
18
97
@OussamaMater
OussamaMater
7 months
Laravel Tip💡: Save Multiple Related Models Did you know that Laravel allows you to save multiple related models at once by using the "saveMany" method? 🚀 #laravel #php
Tweet media one
2
18
98
@OussamaMater
OussamaMater
1 month
Laravel Tip💡: Disable Model Events When Seeding In most cases, when seeding the database, you don't need to fire model events. You can use the "WithoutModelEvents" trait to mute those events, making your seeders slightly faster 🚀 #laravel
Tweet media one
0
19
97
@OussamaMater
OussamaMater
7 months
Laravel Tip💡: Task Hooks Did you know that Laravel allows you to define callbacks to be executed based on the result of a scheduled task? This helps log failures or execute related actions on success 🚀 #laravel #php
Tweet media one
0
26
94
@OussamaMater
OussamaMater
23 days
Laravel Tip 💡: Auto Capitalize Your Translations Did you know that not only can you parameterize your translation strings, but you can also auto-capitalize them? 🚀 #laravel
Tweet media one
1
17
95
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: Human-readable Numbers Sometimes you may want to format numbers for your users in a human-readable format. The "Number" helper allows you to do just that 🚀 #laravel
Tweet media one
1
15
94
@OussamaMater
OussamaMater
6 months
Laravel Tip💡: The "containsOneItem" Method Sometimes we want to ensure a collection has a single item. Instead of calling the count method on the collection, there is an elegant method called "containsOneItem" that does the same 🚀 #laravel
Tweet media one
1
9
95
@OussamaMater
OussamaMater
7 months
Laravel Tip💡: Custom Route Model Binding Resolution Laravel's route model binding is a powerful feature that automatically injects your model into your controller. If you wish, you can implement custom logic for resolution by defining "resolveRouteBinding" 🚀 #laravel #php
Tweet media one
2
14
95
@OussamaMater
OussamaMater
6 months
Laravel Tip💡: The "Sleep" Helper Did you know that Laravel ships with a fluent wrapper for the PHP "sleep" method? This not only makes the code readable but also testable, as you can fake the Sleep class 🚀 #laravel
Tweet media one
0
16
95
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: The "data_get" Helper When working with nested arrays, Laravel provides a cool helper called "data_get". This helper allows you to use dot syntax and wildcards to retrieve values 🚀 #laravel
Tweet media one
2
10
94
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Swap Multiple Strings When working with strings, we often need to find and replace occurrences of multiple strings. Laravel ships with an elegant method "swap" to do exactly that 🚀 #laravel
Tweet media one
1
17
94
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Find Many Did you know you can pass multiple IDs to the "find()" method? Laravel also ships with a slightly more readable version, "findMany()", which does the same thing! 🚀 #laravel
Tweet media one
0
13
93
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Delete (Destroy) Records Did you know that Laravel ships with the "destroy" method, which allows you to delete records by their primary key? 🚀 #laravel
Tweet media one
2
16
93
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Type Hinting for Blade We use Blade a lot, and if I have one thing to complain about, it's type hints. However, we can solve this issue by defining a " @php " block for all the variables used 🚀 #laravel
Tweet media one
2
10
92
@OussamaMater
OussamaMater
7 months
Laravel Tip💡: Hook into Authentication Events Did you know that the Laravel authentication component comes with multiple events you can listen to? Whether a user attempts to log in or fails to do so, you can handle these events as you wish 🚀 #laravel
Tweet media one
1
19
90
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Customize the Redirect Location We often use form requests for validation. Did you know you can customize the redirect location upon failure? You are never limited to redirecting users back to the previous page 🚀 #laravel
Tweet media one
2
14
89
@OussamaMater
OussamaMater
6 months
Laravel Tip💡: The "withExists" Method Did you know that Laravel ships with a method called "withExists" which allows you to check if a model has a relationship or not? 🚀 #laravel
Tweet media one
2
12
87
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Generate Fake User Agents Since Laravel uses FakerPHP under the hood, you can generate fake user agents for your tests 🚀 #laravel
Tweet media one
0
14
88
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Shortcuts for Dropping Columns Need to drop some framework-specific columns? You don’t have to specify them manually, Laravel provides shortcuts to do exactly that 🚀 #laravel
Tweet media one
2
7
86
@OussamaMater
OussamaMater
6 months
Laravel Tip💡: HTTP Client Handler Stats The Laravel HTTP Client uses Guzzle under the hood, providing access to statistics for each request you make. That includes total time, download speed, and much more 🚀 #laravel
Tweet media one
1
14
87
@OussamaMater
OussamaMater
3 months
Laravel Tip 💡: Formatting to a Human-Readable File Size Did you know Laravel ships with a "fileSize" helper to get the file size representation of a given byte value as a string? 🚀 #laravel
Tweet media one
0
11
85
@OussamaMater
OussamaMater
21 days
Laravel Tip 💡: Cache Accessor Result When working with accessors, objects are cached by default. However, if you have a computationally intensive accessor for a primitive value, like a string, you can enable caching for it using the "shouldCache()" method 🚀 #laravel
Tweet media one
3
10
86
@OussamaMater
OussamaMater
5 months
Laravel Tip💡: Clean Up After Failed Jobs When jobs fail, you may want to send notifications or perform some cleanups. Luckily, Laravel allows you to define a "failed" method to do exactly that 🚀 #laravel
Tweet media one
2
11
85
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Filter Null Values When working with arrays, we sometimes need to filter out null values. Laravel ships with an elegant helper "whereNotNull" to do exactly that 🚀 #laravel
Tweet media one
1
13
85
@OussamaMater
OussamaMater
7 months
Laravel Tip💡: Randomly Order Query Results Did you know that Laravel comes with the "inRandomOrder" method, which sorts query results randomly? 🚀 #laravel #php
Tweet media one
5
15
84
@OussamaMater
OussamaMater
1 month
Laravel Tip💡: Lazily Refresh Your Database We often need to refresh the database when testing the code. In such cases, you can lazily refresh your database, so migrations are run only when you are hitting the db. This will help speed up your tests 🚀 #laravel
Tweet media one
2
11
83
@OussamaMater
OussamaMater
1 month
Laravel Tip 💡: Better Error Messages for Arrays When validating arrays, it's a better UX to tell the user which item has failed rather than throwing a generic message. For this, you can use the ":index" and ":position" placeholders 🚀 #laravel
Tweet media one
1
13
84
@OussamaMater
OussamaMater
3 months
Laravel Tip 💡: Freeze Time When writing tests, we sometimes need to "freeze" time to make assertions. Laravel provides an elegant method "freezeTime" to do exactly that 🚀 #laravel
Tweet media one
1
15
84
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: Run Commands In the Background Scheduled commands run sequentially. If you have a long-running task, it could take longer than anticipated and cause a delay for other tasks. Luckily, in such cases, you can use the "runInBackground" method 🚀 #laravel
Tweet media one
1
16
84
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: Truncate Long Strings Sometimes you may want to truncate long descriptions for display. Laravel ships with the "limit" method to do just that, and in the upcoming version, you can preserve whole words for a better UX 🚀 #laravel
Tweet media one
1
13
84
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Log Out The Current Device Only Did you know that Laravel ships with the "logoutCurrentDevice" method, which allows you to log out only the currently authenticated device? 🚀 #laravel
Tweet media one
1
8
82
@OussamaMater
OussamaMater
6 months
Laravel Tip💡: Make Use Of Factory States Did you know that Laravel factories allow you to define states? You can use multiple states to describe the object and apply discrete modifications to it. This also makes the code more readable! 🚀 #laravel
Tweet media one
0
16
82
@OussamaMater
OussamaMater
5 months
PHP Tip💡: Much Readable Numbers If you work with numbers, the longer they are, the harder they get to read. Did you know you can use underscores for better readability? 🚀 #laravel
Tweet media one
3
12
81
@OussamaMater
OussamaMater
12 days
Laravel Tip 💡: Execute Tasks Concurrently Starting from Laravel v11.23, you can execute tasks concurrently. This can speed things up when you have independent tasks that can be run simultaneously 🚀 #laravel
Tweet media one
2
20
87
@OussamaMater
OussamaMater
19 days
Laravel Tip 💡: On-Demand Notifications Sometimes, you may want to send notifications to "anonymous" users who are not yet stored in the database. Laravel's "route" method allows you to do exactly that 🚀 #php #laravel #webdevelopment #tipsandtricks
Tweet media one
0
8
81
@OussamaMater
OussamaMater
7 months
Laravel Tip💡: The "rescue" Helper Sometimes we are forced to use a try-catch block just to ignore an expected exception and default to a value. In such cases, you can use the "rescue" helper that Laravel ships with🚀 #laravel #php
Tweet media one
1
19
81
@OussamaMater
OussamaMater
6 months
Laravel Tip💡: The "throw_if" and "throw_unless" Helpers Did you know that Laravel ships with two helpers, "throw_if" and "throw_unless," which not only make your code shorter but also much more readable? 🚀 #laravel
Tweet media one
0
14
79
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: Better Checks For Input Presence We often need to check if a request contains certain values. Did you know that Laravel ships with two cool methods, "has" and "hasAny", to perform these checks elegantly? 🚀 #laravel
Tweet media one
0
10
80
@OussamaMater
OussamaMater
5 months
Laravel Tip💡: Mask Strings Ever found yourself in need of masking an email or a verification code for security purposes? Laravel ships with the "mask" method to do exactly that! You can always combine it with other methods to avoid leaking the length of the string 🚀 #laravel
Tweet media one
1
12
80
@OussamaMater
OussamaMater
1 month
Laravel Tip 💡: The "checked" Blade Directive Often, we need to conditionally mark an input as checked. While this can be done manually, Laravel provides a cool blade directive "checked" to do exactly that 🚀 #laravel
Tweet media one
1
12
79
@OussamaMater
OussamaMater
4 months
Laravel Tip💡: The "sole" Method When working with collections, whether regular or Eloquent, if you want to get the first item that matches the condition and ensure it is the only one, use the "sole" method 🚀 #laravel
Tweet media one
0
10
79
@OussamaMater
OussamaMater
3 months
Laravel Tip💡: Insert Or Ignore Sometimes, you might want to ignore errors when inserting data. Laravel comes with the "insertOrIgnore" method that does exactly that 🚀 #laravel
Tweet media one
2
13
78
@OussamaMater
OussamaMater
5 months
Laravel Tip💡: Bootable Traits Did you know that Laravel automatically boots your traits if they follow the "boot[TraitName]" convention? This allows you to easily define shared logic for model events. And here's a secret: that's where multi-tenancy starts 🚀 #laravel
Tweet media one
1
7
73
@OussamaMater
OussamaMater
5 months
Laravel Tip💡: Faster Queries with "whereIntegerInRaw" When using a whereIn query with non-user input, opt for whereIntegerInRaw. This speeds up your query by skipping PDO bindings and Laravel's security measures against SQL injection 🚀 #laravel
Tweet media one
1
16
77
@OussamaMater
OussamaMater
7 months
Laravel Tip💡: The "whenTableDoesntHaveColumn" and "whenTableHasColumn" methods Laravel 9 and onward ships with 2 schema methods, 'whenTableDoesntHaveColumn' and 'whenTableHasColumn', which allow you to drop or create a column if it exists or not. #laravel #php
Tweet media one
2
19
78
@OussamaMater
OussamaMater
6 months
Laravel Tip💡: The "Benchmark" Helper Did you know that Laravel 9.32 and above comes with a handy helper called "Benchmark" that allows you to measure the number of milliseconds it takes for the given callbacks to complete? 🚀 #laravel
Tweet media one
1
8
78
@OussamaMater
OussamaMater
2 months
Laravel Tip💡: The "last" and "head" helpers Did you know that Laravel ships with two helpers, "last" and "head"? They allow you to retrieve the first and last elements of an array 🚀 #laravel
Tweet media one
1
11
78