$items = DB::table('items')
->select('id', 'ref_code', 'name', 'price')
->where('ref_code','=', $request->ref_code)
->first();
// let's assume user_id is 5
DB::table('attendances')
->where('date_only', '=', $newdate)
->orderBy('logon','asc')
->pluck('user_id'); // "5"