PHP Snippets

Future SoftDeletes Trait in Laravel 8

Future SoftDeletes Trait in Laravel 8

Laravel provides the built-in feature that allows us to flag database rows as deleted without physically deleting them from the database. The issue with this feature is that it only returns rows where deleted_at is null... read the rest »
The correct way to handle file downloads in PHP

The correct way to handle file downloads in PHP

I’ve seen many download scripts written in PHP, from simple one-liners to dedicated classes. At least half of them share common issues; in many cases programmers simply copy the code from something that works, without even attempting to understand what it really does... read the rest »