Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $this->builder
- ->select('*') // needs to be here, otherwise the only returned column will be `last_login`
- ->selectSub(function ($q) {
- $q->from('action_logs')
- ->whereColumn('user_id', 'users.id')
- ->selectRaw('max(created_at)');
- }, 'last_login')
- ->get();
- // all columns from the table...
- // last_login => '2019-01-16 12:34:56'
Add Comment
Please, Sign In to add comment