Andrea Pozza

3.7K posts

Andrea Pozza banner
Andrea Pozza

Andrea Pozza

@andreapozza_

La vita è meravigliosa... senza sarei morto.

Milan, Lombardy Katılım Ocak 2011
169 Takip Edilen218 Takipçiler
Punyapal Shah
Punyapal Shah@MrPunyapal·
Most Laravel developers know about: withCount() withSum() withMax() But very few know all of them are powered by one underrated method: withAggregate() It can even fetch a single relationship column without loading the full model. Pretty elegant Laravel feature.
Punyapal Shah tweet media
English
1
7
50
1.9K
Andrea Pozza
Andrea Pozza@andreapozza_·
@MrPunyapal @PovilasKorop I feel this! Having dd() show SQL on a Model instance feels wrong. Wouldn't it be better to add a dd() method directly to the Model class to prevent it from forwarding to the query builder?
English
2
0
0
16
Povilas Korop | Laravel Courses Creator & Youtuber
Laravel tip on SQL query debugging. Did you know you can append `->dd()` to any Eloquent query instead of `->get()`? Or, even better: did you know about `->ddRawSql()` method? Screenshots from Artisan Tinker.
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
4
11
51
2.4K
Andrea Pozza
Andrea Pozza@andreapozza_·
@MrPunyapal Is the method coming out of the box or it's a custom scope?
English
1
0
0
384
Punyapal Shah
Punyapal Shah@MrPunyapal·
Just done a little change on the Laravel Basic CRUD project. Does it look more expressive and readable? 🤔
Punyapal Shah tweet media
English
10
5
105
8.2K
Andrea Pozza
Andrea Pozza@andreapozza_·
Hey @aarondfrancis, any updates on the future of FusionPHP? Still one of the most exciting concepts in the ecosystem. Would love a quick status check! ⚡️
English
1
0
6
10.8K
Andrea Pozza
Andrea Pozza@andreapozza_·
@furiouswhopper @magadum_aniket I partially agree. A local scope would help, User::whereNullOrEmpty('middle_name')->get(). Even better, cleaning the database if possible.
English
1
0
1
18
Angurī Wappā
Angurī Wappā@furiouswhopper·
@andreapozza_ @magadum_aniket The SQL that this generates is a million times clearer and easier to read than this is. Shoving all of the operators randomly into variables, llambda params, and function names is crazyyyy
English
1
0
1
22
Aniket Magadum
Aniket Magadum@magadum_aniket·
Hey Laravel Developers 👩‍💻 Even after working with PHP and MySQL for so many years, I often find myself forgetting this scenario in MySQL. So whenever you query based on whether a column is null in a table, always remember that this won't include any empty strings, as an empty string and null values are two different data types in MySQL. So, if you are working with Laravel and there is a possibility of a column being an empty string as well, always add a conditional for the same, as shown in the code snippet below. #laravel #php
Aniket Magadum tweet media
English
7
5
59
4.8K
Andrea Pozza
Andrea Pozza@andreapozza_·
When you start using third-party components and stop worrying about compatibility with the existing style system, you really understand the power of #tailwind. #css
English
0
0
0
45
Angurī Wappā
Angurī Wappā@furiouswhopper·
@magadum_aniket If only there was a standard language for queries that we could use instead of this ugly chained query builder hackery...
English
2
0
2
258
Andrea Pozza retweetledi
Punyapal Shah
Punyapal Shah@MrPunyapal·
Laravel devs, one of my followers asked me: “Where can I see all available PHP attributes in Laravel?” I thought about it for a bit… couldn’t find a clear answer. So I created a repo that lists all PHP attributes used in the Laravel framework. Link in comments 👇
Punyapal Shah tweet media
English
9
19
142
12.8K
Andrea Pozza
Andrea Pozza@andreapozza_·
@MrPunyapal I know people who know JQuery without knowing JavaScript
English
2
0
2
62
Punyapal Shah
Punyapal Shah@MrPunyapal·
Can anyone learn Typescript before javascript 👀 (I mean advance JS who doesn't know basic JS)
English
12
0
5
1.6K
Andrea Pozza
Andrea Pozza@andreapozza_·
@_newtonjob What frustrates me here are those invokable controllers 😄
English
1
0
3
179
Newton Job
Newton Job@_newtonjob·
Would you really call this inconsistency?
Newton Job tweet media
English
7
1
24
3.5K
Newton Job
Newton Job@_newtonjob·
@Ogumons No. I don’t see how can possibly work. How does the proxy identify the user? How does know which routes must be ratelimited if you don’t implement it at Laravel. How does it even know whether or not a request should be counted against the rate limit? This isn’t generic stuff
English
2
0
1
58
Newton Job
Newton Job@_newtonjob·
Very underrated rate-limiting feature in Laravel. You can very easily apply dynamic rate limiting on a route based on the value of a database column on your users table🤌
Newton Job tweet media
English
5
11
111
5.9K
Newton Job
Newton Job@_newtonjob·
Very common practice for timestamp column names to have the "_at" suffix. But is there a convention for things that are valid until a certain timestamp in the future? e.g. banned_until? I'm thinking "banned_until_at", but sounds a lil wierd.
Newton Job tweet media
English
37
2
41
13.4K
Aniket Magadum
Aniket Magadum@magadum_aniket·
Hey PHP Developers 👩‍💻 Here is a quick, small tip when working with classes in Laravel. Sometimes in a class, you might have a method that does a long task and may be called multiple times in a web request. In that case, you may create a property on the class itself and cache the result there so that we won't compute the method again and again. A very simple trick indeed, but maybe very useful if you want slight performance upgrades. You might see this pattern being used at multiple places across the Laravel Framework. #laravel #php
Aniket Magadum tweet media
English
9
9
132
8.4K
Povilas Korop | Laravel Courses Creator & Youtuber
Laravel practical example: `firstOrCreate()`. AI generated this code (version 1) for me. I told it there's a better way with `firstOrCreate()` It refactored, saying "you're absolutely right". Now we're both happy.
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
4
7
99
6.5K
Andrea Pozza
Andrea Pozza@andreapozza_·
@_newtonjob Personally, I like prefix boolean attributes with `is_`. Anyway, the custom builder seems to be the only option if you don't want to rely on old syntax.
English
0
0
1
137
Newton Job
Newton Job@_newtonjob·
One of my biggest indecision moments. Should I keep the attribute or the scope?
Newton Job tweet media
English
20
4
67
12K
Alexander Lichter
Alexander Lichter@TheAlexLichter·
Vitest: Visual Regression Testing in v4 👀 Yes, you read correctly! @vitest_dev has a new `toMatchScreenshot` functionality that enables visual regression testing right in your favorite testing framework Available from v4.0.0-beta.4 on. More in the PR! github.com/vitest-dev/vit…
English
9
31
250
23.4K
Taylor Otwell
Taylor Otwell@taylorotwell·
One of my Laravel ✨ best practices ✨ is only using the 7 "restful" methods in my controllers. Controllers only have: index, show, create, store, edit, update, delete. Think you need another method? You really need another controller. Built *all* of Vapor like this.
English
131
213
1.7K
207.9K
Andrea Pozza
Andrea Pozza@andreapozza_·
@PovilasKorop I always go with `foreignIdFor`. This way, the relationship between entities is quite obvious, and I let the framework handle the rest.
English
0
0
1
106
Povilas Korop | Laravel Courses Creator & Youtuber
Show of hands: A or B syntax? I personally prefer A, because it's clear to me. But all AI models always suggest to be verbose and generate option B. Maybe I should comply?
Povilas Korop | Laravel Courses Creator & Youtuber tweet media
English
30
2
48
13.2K
Ralph Schindler
Ralph Schindler@ralphschindler·
@andreapozza_ @taylorotwell @calebporzio I understand that. The default skeleton has Volt components, blade components, flux components, a views/livewire directory, partials.. The layouts can't be Volt components. There is still an App\Livewire\Actions\Logout, which seems out of place. Hard to see what the vision is.
English
1
0
0
49
Taylor Otwell
Taylor Otwell@taylorotwell·
When it comes to quickly prototyping a front end with no fuss or headaches I swear Laravel + Volt + Flux by @calebporzio has to be the fastest stack in the world.
English
22
24
410
35.6K