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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners