Here's an example. Claude changed nav to div and wanted to add this comment: html <!-- a div, not a <nav>: role="tablist" would override the landmark anyway --> Something like that might be useful in some very rare cases where the decision is really non-standard. But sometimes it feels like it's goi...
The ability to communicate and enforce types and their relations is cool and would be useful, but... from time to time I remember about the languages where they do exist. I noticed this answer on SE hot questions today: https://stackoverflow.com/a/79879731 Here's a fragment of that code: public stat...
Over multiple recent discussions I've read that static methods are a code smell and that using them for pure functions is a hacky workaround for autoloading issues. You know what's also a code smell? Using classes and objects when you're not modelling any entity by them. Look at a controller, what d...
Suppose you have your Post model and it has all the typical CRUD endpoints with their handlers in your PostController: php Route::resource('posts', PostController::class); However, you also need to have an option to mark many posts and publish them all with a single request. Or delete them all. What...
Few months ago people were wondering whether FB still uses PHP. I recently noticed (pic post) that they are now explicitly showing it off. Instead of their previous pretty paths a la facebook.com
Edit & PSA: This was a joke report for April Fools' Day In the allow extending enum internals discussion someone brought up that it would be useful to extend enums. This was rejected as a BC break as it would sometimes allow us to rewrite our crashing code to make it crash with a different error mes...
RFC internals discussion previous reddit thread TLDR: I no longer intend to upstream my PHP improvements. Sorry for the noise. – Max What a shitshow! This should keep away anyone who cares about contempor
I'm working on a small package that allows manipulating images via URLs: https://github.com/GlaivePro/image/ I am looking for some feedback before tagging the v1. Any comments on the API or the implementation would be appreciated. The main goal is image resizing: by requesting https://example.com/im...
My API accepts an array, e.g. [ {"name": "Rex"}, {"name": "Tod"} ] The business requirement is that the length of this array must be between 1 and 100. Is it possible to apply a set of validation rules to the top level array? It appears that '' => 'array|min:1|max:100' applies to nothing and '' => '...
Few years ago I made a small package for full page caching. Recently I needed such caching in a new project and to my surprise it still worked just as fine. I added a feature that I needed now and it serves me very well once again. Now this piece is not tested and I make no promises on maintaining i...
Here's an example of the need: php $user->realestate = DB::raw('ST_GeomFromGeoJSON(?)', [$geometry]); $user->save(); Of course, you can put anything like unaccent, unhex, to_tsvector instead of ST_GeomFromGeoJSON. There's plenty of cases where you need to set a non-trivial expression. Unfourtunately...
I have my Article and Category models. They have the relationship defined: // app\Models\Article.php public function categories() { return $this->belongsToMany(Category::class); } // app\Models\Category.php public function articles() { return $this->belongsToMany(Article::class); } Now I'm trying to...
Hey, everyone! Now that Hacktoberfest rules are updated so that repositories have to opt in, it's harder to find projects that I am interested and able to contribute to. Of course, I can create PRs on my own projects, but that kind of defeats the spirit of the project. Maybe we could share our own L...
wkhtmltopdf was the best, but by now it's running on an awfully outdated webkit. Dompdf is struggling to keep up with the ever-evolving CSS. It seems that something analogous to snappy but with a headless chrome as the renderer should be the tool. I've seen a couple of such libraries, but no one sta...
So, I had my first real project in the new Laravel. Fortify is good. But the frontend scaffolding has become useless for me. I was planning to use Vue on the project, so I selected the Inertia stack. The routes file was unfamiliar, the views were split over everywhere. I understood there's too much...
It appears that the default templates are full of {{ ('Welcome') }}. To me the run of punctuation characters looks as friendly as JavaScript's ;(() => {});, I tend to use @lang('Welcome'). Which syntax do you use in the blade templates?
Sometimes I have to work in other frameworks or plain PHP projects. I see so much of the Laravel tools either missing or underdeveloped. I even tend to implement some of those myself. I've copied a couple of string or array helpers everywhere, I've implemented Laravel-like get and set on models in Z...
I was using the folklore/image package in multiple projects. It's abandoned for the past few years... I managed to get it working in 5.8 some time ago, but by now it's too outdated. Is there a direct replacement? Or a replacement that could do it with some additional legwork? It worked like this: Yo...
I somehow hadn't noticed anything special about this community, but this thread today is so overwhelmingly positive... https://www.reddit.com/r/laravel/comments/hwf76b/failed_a_laravel_coding_exercise_for_a_job/ Everyone is so helpful and polite. OP is keen and takes every comment well even the one...
If you have two (or more) models that have attributes relying on relation with the other model, the model can't be serialized, it takes manual tinkering each time. class Group extends Model { protected $appends = ['deletable']; public function members() { return $this->hasMany(Member::class); } publ...
We are continuing our experiments with encapsulating the smallest features in tiny packages. The goal of our research is to understand how feasible it is to split a project into tiny packages, what benefits it brings and how large is the work overhead. So here I am sharing another package (this was...
I have not tried using algolia on my own projects, but the experience on laravel.com is horrendous - too few results, can't open full results, can't open in new tab etc. Is it worth looking into it, can it actually be used for searching?
Hi, We are experimenting with encapsulating tiny features in separate packages. I wanted to share with you one such package. Encrypted is a package that provides a couple of simple custom casts for Eloquent models. php <?php namespace App; use Illuminate\Database\Eloquent\Model; use Crudly\Encrypted...
A couple of days ago one of us posted a link to their Laravel knowledge base in a Q&A format. I think the idea of such a list is great and the selection of questions is nearly passable. However the answers were not. Maybe we can redo it properly together? I googled a little and the lists named "la