iamgurmandeep Profile Banner
Gurmandeep Singh Profile
Gurmandeep Singh

@iamgurmandeep

Followers
809
Following
2K
Media
270
Statuses
630

Sr. Software Engineer

Joined June 2012
Don't wanna be here? Send us removal request.
@iamgurmandeep
Gurmandeep Singh
4 days
πŸš€ New in #Laravel: Use `whenTableHasIndex()` and `whenTableDoesntHaveIndex()` to run logic based on whether your DB table already has an index. Perfect for safer migrations.
0
0
1
@iamgurmandeep
Gurmandeep Singh
3 months
#Laravel Tip πŸš€ In Laravel 12, you can automatically cast Eloquent attributes to HTML strings using `AsHtmlString::class`.
1
4
99
@iamgurmandeep
Gurmandeep Singh
3 months
#Laravel Tip πŸš€ In Laravel 12, you can use the `toResource()` helper directly on your Eloquent models. Just fetch your data, and instantly convert it into a clean, structured API resource.
4
6
133
@iamgurmandeep
Gurmandeep Singh
3 months
#PHP Tip πŸš€ In PHP 8.3, you can use the `json_validate()` function, a super easy way to check if a string is valid JSON.
0
1
4
@iamgurmandeep
Gurmandeep Singh
3 months
#Laravel Tip πŸš€ In Laravel, the `Arr::hasAll` method allows you to check if all the specified keys are present in an array. It supports nested keys using dot notation and returns true only if every key exists.
0
9
83
@iamgurmandeep
Gurmandeep Singh
3 months
#Laravel Tip πŸš€ The `Str::mask` method hides part of a string by replacing it with a repeated character, making it useful for covering things like emails or phone numbers.
3
15
127
@iamgurmandeep
Gurmandeep Singh
3 months
#Laravel Tip πŸš€ You can use the `whenEmpty` method to run a callback if the collection is empty.
0
1
8
@iamgurmandeep
Gurmandeep Singh
3 months
#Laravel Tip πŸ”₯ In Laravel, you can use the `whenNotExactly` method to execute a callback if a string is not an exact match, and you can add a second callback to execute if the string is an exact match.
0
1
6
@iamgurmandeep
Gurmandeep Singh
3 months
#Laravel Tip πŸš€ In Laravel, the `Number` class provides a `currency` method that formats currencies with locale support.
0
0
3
@iamgurmandeep
Gurmandeep Singh
3 months
#Laravel Tip πŸš€ In Laravel, the whereAny method allows you to search across multiple columns using OR logic.
0
0
8
@iamgurmandeep
Gurmandeep Singh
3 months
#Laravel Tip πŸš€ if you only need a custom rule once, use a closure instead of a rule class. The closure gets the field name, its value, and a fail() callback for invalid data.
0
0
5
@iamgurmandeep
Gurmandeep Singh
4 months
#Laravel Tip πŸš€ Laravel introduced a new collection method `toPrettyJson`, which formats the collection as a neatly indented JSON string using PHP's JSON_PRETTY_PRINT option. https://t.co/RRYRxhFiTM
0
1
9
@iamgurmandeep
Gurmandeep Singh
4 months
#Laravel Tip πŸ”₯ You can use `incrementEach()` method to increment multiple columns with a single query.
0
6
64
@iamgurmandeep
Gurmandeep Singh
4 months
#Laravel Tip πŸ”₯ You can use the 'replicate' method to create the unsaved copy of the existing model instance.
1
5
90
@iamgurmandeep
Gurmandeep Singh
4 months
#Laravel Tip πŸš€ You can use `@use()` directive to import a PHP class into a Blade template without using raw PHP tags.
1
0
9
@iamgurmandeep
Gurmandeep Singh
4 months
#Laravel Tip πŸš€ `withWhereHas()` method simplifies cases where you have to repeat code used to both filter with `whereHas()` and select the same record via `with()`.
0
0
4
@iamgurmandeep
Gurmandeep Singh
4 months
#CSS Tip πŸ”₯ You can use the `text-wrap: pretty` property to improve text layout. It helps create cleaner body copy with smoother line breaks and fewer orphaned words.
0
0
5
@iamgurmandeep
Gurmandeep Singh
4 months
#Laravel Tip πŸš€ You can use `required_if_accepted` validation rule which ensures the field under validation is required if another field is accepted (a value of yes, on, 1, or true).
0
0
1
@iamgurmandeep
Gurmandeep Singh
4 months
#Laravel Tip πŸš€ To apply default settings to every outgoing HTTP request, call the `globalOptions` method within the boot method of your AppServiceProvider.
0
0
1
@iamgurmandeep
Gurmandeep Singh
4 months
In #Laravel, the HasMiddleware interface lets you attach middleware directly to a controller. To use it, implement a static middleware method in your controller. This method should return an array of the middleware you want to apply to the controller’s actionsπŸš€
0
0
1