Overview for 'sebastiandedeyne'
Written by Sebastian De Deyne
/ Original link
on Jul. 25, 2022
The markdown specification allows you to inline HTML in a markdown document. This is a regular paragraph. <table> <tr> <td>Foo</td> </tr> </table> This is another regular paragraph. But once you’re in HTML, you can’t write markdown anymore. If you’d want to itali…
Written by Sebastian De Deyne
/ Original link
on Jun. 1, 2022
Sometimes you want to store data in your Alpine component without wrapping it in a JavaScript proxy (which is how Alpine keeps everything reactive). For example, third party libraries might have issues when wrapped in a proxy. Chart.js is one of those. If you store a Chart.js instance in Alpine dat…
Written by Sebastian De Deyne
/ Original link
on Feb. 22, 2022
Laravel 9 is fresh out the door, and it contains a small contribution of mine: a new callOnce method for database seeders. It solves a problem with seeders I’ve had for a long time, and thanks to @brendt_gd and @rubenvanassche’s input I was able to propose a lightweight solution. Here’s a quick ove…
Written by Sebastian De Deyne
/ Original link
on Jan. 10, 2022
A view model represents data for a specific view or page. In its simplest form, a view model is a plain PHP object with a bunch of (typed) properties. class ProfileViewModel { public function __construct( public User $user, public array $companies, public string $action, ) {} } View models make the…
Written by Sebastian De Deyne
/ Original link
on Dec. 16, 2021
The other day I needed to sort a dataset in MySQL and ensure one value was always at the end. I never fully understood how order by works, so I did some research on how to solve my problem and how order by behaves. The data set looks like a list of jobs. I want to present them alphabetically sorted…
Written by Sebastian De Deyne
/ Original link
on Nov. 23, 2021
I use Model::findOrFail a lot in Laravel. Recently, I realized it’s not always the best option. findOrFail is great because it ensures you’ll end up with a model instance. No more “Attempt to read property on null” exceptions. $title = Post::findOrFail($id)->title; Another benefit is that Larave…