Source: sebastiandedeyne.com

Comparing two database columns in Laravel
https://sebastiandedeyne.com/comparing-two-database-columns-in-laravel/ https://sebastiandedeyne.com/tags/laravel/When you want to compare two database columns in Laravel, you can’t use where because it treats the argument you’re comparing to as a value. Instead, Laravel has a whereColumn method you can use to compare a value to another column’s value. // Retrieve posts that were updated after // they were published. Post::query() ->whereColumn('updated_at', '>', 'published_at') ->get();
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners