/** * Display a listing of the resource * * @return \Illuminate\Http\Response */ public function index() { $users = User::get(); $firebase = new \Firebase\FirebaseLib(env('FIREBASE_URL'), env('FIREBASE_SECRET')); $online_users = json_decode($firebase->get('presence/')); $online = collect([]); if ($online_users != null) { foreach ($online_users as $key => $value) { if ($value) { $user = User::find($key); $online->push($user); } } } //dd($online); return view('cms.user.index', compact('users', 'online')); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $users = User::get(); return view('cms.winner.create', compact('users')); }