laravel v6x addselect always returns a null value for the subquery field

I might be wrong here but I think you have to use whereColumn instead of where to actually use the value of the column and not just a string with the column’s name.

$users = User::query()
        'latest_login' => Login::select('login_time')
            ->whereColumn('logins.user_id', '')
    ->orderBy('latest_login', 'DESC')

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top