PHPnews.io

Overview for 'sebastiandedeyne'


Laravel Blade & View Models

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…



Eloquent findOrFail caveats

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…


The Monetization Trap

Written by Sebastian De Deyne / Original link on Aug. 10, 2021

I want to talk about something I’ve been chewing on for a while: the monetization trap. Last year, I had a hard time writing a post, sending a newsletter, or researching a topic without considering if it could be part of some grand monetization scheme. Everyone and their dog seemed to have a projec…


Ebb and flow

Written by Sebastian De Deyne / Original link on Aug. 9, 2021

I’ve been thinking a lot about work-life balance lately. I used to see it as a balancing scale that should remain on the same position at all times. However, I believe a better mental model is to see it as ebb and flow. There are times you need to focus on work. There are times you need to focus on…