Esempio n. 1
0
 public function show(Request $request, $id)
 {
     $session = $this->sessionManager->read($id);
     if (is_null($session)) {
         return redirect('/');
     }
     if ($session->isPrivate()) {
         $password = \Session::get('session.' . $session->getId() . '.password', '');
         if (!$session->unlock($password)) {
             return redirect('/');
         }
     }
     $categories = new \App\Models\CategoryList($session);
     $token = array();
     $token['timestamp'] = time();
     $client = new \phpcent\Client(env('CENT_HOST'));
     $client->setSecret(env('CENT_SECRET'));
     $token['hash'] = $client->generateClientToken('', $token['timestamp']);
     if ($request->isXmlHttpRequest()) {
         return $session->getObjects();
     } else {
         return view('show', compact('categories', 'session', 'token'));
     }
 }