Cool Tips

975 posts

Cool Tips banner
Cool Tips

Cool Tips

@coool_tips

We are friends who love programming and we would like to help learn it and spread it to others and help solve the problems that our developers friends also face

Aga, Dakahlia, Egypt 가입일 Mayıs 2022
26 팔로잉34 팔로워
Cool Tips 리트윗함
Povilas Korop | Laravel Courses Creator & Youtuber
Laravel tip. Location-based filtering is a common requirement: - “find nearby” - “within X km” - “order by distance” Eloquent scope helps avoid repeating Haversine queries. You may put it into a Trait to use it in many models. Or maybe even a Package to use in many projects.
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
10
21
148
6.2K
Cool Tips 리트윗함
Backpack for Laravel
Backpack for Laravel@laravelbackpack·
#Laravel Tip 💡 Middleware groups are great — until one route needs an exception. Laravel’s withoutMiddleware() lets you exclude inherited middleware on a single route without restructuring your routes 🚀
Backpack for Laravel tweet media
English
1
1
44
1.3K
Cool Tips 리트윗함
Povilas Korop | Laravel Courses Creator & Youtuber
Laravel/PHP tip. Did you know PHP enums can act as a state machine? Define allowed transitions with `match` inside Enum. Then, use that function for validation elsewhere. Then, the enum IS the source of truth.
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
10
23
252
11.3K
Cool Tips 리트윗함
Backpack for Laravel
Backpack for Laravel@laravelbackpack·
Did you know… With #Laravel’s incrementEach() and decrementEach() methods, you can easily update multiple counter columns in a single query:
Backpack for Laravel tweet media
English
1
8
53
1.6K
Cool Tips 리트윗함
Backpack for Laravel
Backpack for Laravel@laravelbackpack·
#Laravel Tip ⚠️ Are you updating records while looping with lazy()? lazy() paginates using offsets. If your update changes the query condition, rows can be skipped or processed twice. lazyById() paginates by primary key instead — stable, predictable, safe. That’s why it exists 🚀
Backpack for Laravel tweet media
English
0
7
67
1.8K
Cool Tips 리트윗함
Backpack for Laravel
Backpack for Laravel@laravelbackpack·
#Laravel Tip Load data faster when the targeted values are integer. Use 𝘄𝗵𝗲𝗿𝗲𝗜𝗻𝘁𝗲𝗴𝗲𝗿𝗜𝗻𝗥𝗮𝘄() instead of the 𝘄𝗵𝗲𝗿𝗲𝗜𝗻() method to load data faster when the targeted values are integer.
Backpack for Laravel tweet media
English
1
5
64
2.1K
Cool Tips 리트윗함
Punyapal Shah
Punyapal Shah@MrPunyapal·
Laravel 13 welcome page 👀
Punyapal Shah tweet media
English
4
9
144
7.9K
Cool Tips 리트윗함
Punyapal Shah
Punyapal Shah@MrPunyapal·
Laravel 13 will have `#[Seeder]` for tests 🧪 Declare your seeder on the test class and it runs automatically. Cleaner tests. Better DX. Less boilerplate. Laravel keeps leveling up 🔥
Punyapal Shah tweet media
English
3
12
128
6.9K
Cool Tips 리트윗함
Taylor Otwell
Taylor Otwell@taylorotwell·
Sorry for so much shipping today 😅 but, we also just launched a new starter kit. Laravel + Svelte + Inertia. ❤️ Just update your Laravel installer for access.
Taylor Otwell tweet media
English
53
60
780
67K
Cool Tips 리트윗함
Povilas Korop | Laravel Courses Creator & Youtuber
Laravel tip. Working with a multi-lang project and wanna check if no translations are missing? I've seen packages for this, but actually you can do it in the Pest test. Here's a test method Claude Code suggested to me. Pretty smart, huh?
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
10
9
99
4.9K
Cool Tips 리트윗함
Povilas Korop | Laravel Courses Creator & Youtuber
Example why you should always review AI-generated code. 1. `->get()` downloads ALL DB table data INTO RAM, and only then does `->pluck()` in Collection 2. Unnecessary `::query()` with no benefit (may be useful in other cases) It's not a bug, of course, but kinda bad practice.
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
10
3
65
19.7K
Cool Tips 리트윗함
Backpack for Laravel
Backpack for Laravel@laravelbackpack·
#Laravel Tip Find out queries that take a long time. It's simple to log them using:
Backpack for Laravel tweet media
English
0
5
63
2.4K
Cool Tips 리트윗함
Povilas Korop | Laravel Courses Creator & Youtuber
Laravel tip. Pass Enum values directly to Eloquent scopes with type hints. PHP validates the type automatically, eliminating runtime errors.
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
1
7
75
3.2K
Cool Tips 리트윗함
Vanshika
Vanshika@KathpalVan22610·
HTTP Status Codes - Complete Reference: 1xx: Informational 100 – Continue 101 – Switching Protocols 102 – Processing 2xx: Success 200 – OK 201 – Created 202 – Accepted 204 – No Content 206 – Partial Content 3xx: Redirection 301 – Moved Permanently 302 – Found (Temporary Redirect) 304 – Not Modified 307 – Temporary Redirect 308 – Permanent Redirect 4xx: Client Errors 400 – Bad Request 401 – Unauthorized 403 – Forbidden 404 – Not Found 405 – Method Not Allowed 408 – Request Timeout 409 – Conflict 410 – Gone 413 – Payload Too Large 415 – Unsupported Media Type 418 – I'm a Teapot (Easter egg) 422 – Unprocessable Entity 429 – Too Many Requests 5xx: Server Errors 500 – Internal Server Error 501 – Not Implemented 502 – Bad Gateway 503 – Service Unavailable 504 – Gateway Timeout 507 – Insufficient Storage 508 – Loop Detected
English
7
25
159
6.9K
Cool Tips 리트윗함
Punyapal Shah
Punyapal Shah@MrPunyapal·
Let's break some lagacy apps 😁
English
4
3
36
4.5K
Cool Tips 리트윗함
Povilas Korop | Laravel Courses Creator & Youtuber
Laravel tip. Use `domain()` with route model binding to automatically resolve SUBDOMAINS to models. `{account:slug}.myapp.com` instantly gives you the Account model without manual queries.
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
3
11
107
4.4K
Cool Tips 리트윗함
Backpack for Laravel
Backpack for Laravel@laravelbackpack·
#Laravel Tip Laravel has oldestOfMany(), newestOfMany() and ofMany(), that you can use on a hasMany relationship.
Backpack for Laravel tweet media
English
1
7
60
2.5K
Cool Tips 리트윗함
Povilas Korop | Laravel Courses Creator & Youtuber
Laravel tip. Laravel's factory magic methods like `for()` eliminate boilerplate in your tests. Define BelongsTo relationships once, and Laravel automatically generates convenient `->for{ModelName}()` methods for intuitive test data creation.
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
1
6
47
2.1K
Cool Tips 리트윗함
Freek Van der Herten
Freek Van der Herten@freekmurze·
🔒 Laravel Permission, one of our most popular packages, just got a major update. Add dynamic roles and permissions to your Laravel app with a simple trait. Create roles, assign permissions, and check access using Laravel's built-in authorization. All stored in the database. #laravel #php
Freek Van der Herten tweet media
English
13
29
340
17.3K
Cool Tips 리트윗함
Povilas Korop | Laravel Courses Creator & Youtuber
Laravel tip: `withMax()` aggregation method. In this example, DB has `ratings.rating` column. Each recipe row now has an extra attribute: `user_rating` (the max rating this user gave that recipe).
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
1
3
22
1.8K