For example, I can check every message with a specific date.
$users = User::whereHas('posts', function($q){
$q->where('created_at', '>=', '2015-01-01 00:00:00');
})->get();
But suppose what to do if I want to compare the publication model date (created_at) with the user model date attribute?
For instance:
$users = User::whereHas('posts', function($q){
$q->where('created_at', '>=', ** $user->customDate ** ← look this);
})->get();
update I use "Eloquent" outside of Laravel.
source
share