Beispiel #1
0
 private function getExceptionData($exception)
 {
     $data = [];
     $data['host'] = Request::server('HTTP_HOST');
     $data['method'] = Request::method();
     $data['fullUrl'] = Request::fullUrl();
     if (php_sapi_name() === 'cli') {
         $data['host'] = parse_url(config('app.url'), PHP_URL_HOST);
         $data['method'] = 'CLI';
     }
     $data['exception'] = $exception->getMessage();
     $data['error'] = $exception->getTraceAsString();
     $data['line'] = $exception->getLine();
     $data['file'] = $exception->getFile();
     $data['class'] = get_class($exception);
     $data['storage'] = array('SERVER' => Request::server(), 'GET' => Request::query(), 'POST' => $_POST, 'FILE' => Request::file(), 'OLD' => Request::hasSession() ? Request::old() : [], 'COOKIE' => Request::cookie(), 'SESSION' => Request::hasSession() ? Session::all() : [], 'HEADERS' => Request::header());
     $data['storage'] = array_filter($data['storage']);
     $count = $this->config['count'];
     $data['exegutor'] = [];
     $data['file_lines'] = [];
     $file = new SplFileObject($data['file']);
     for ($i = -1 * abs($count); $i <= abs($count); $i++) {
         list($line, $exegutorLine) = $this->getLineInfo($file, $data['line'], $i);
         $data['exegutor'][] = $exegutorLine;
         $data['file_lines'][$data['line'] + $i] = $line;
     }
     // to make Symfony exception more readable
     if ($data['class'] == 'Symfony\\Component\\Debug\\Exception\\FatalErrorException') {
         preg_match("~^(.+)' in ~", $data['exception'], $matches);
         if (isset($matches[1])) {
             $data['exception'] = $matches[1];
         }
     }
     return $data;
 }
Beispiel #2
0
 public function new_page()
 {
     $first = 'Aarooran';
     $last = 'Kanthasamy';
     //   Session::put('key',$first);
     dd(Session::all());
     return view('check');
 }
 public function store($id)
 {
     $game = $this->gameRepository->getWithId($id);
     Session::put($game->id, $game);
     //session()->get('');
     // ::has('') ::get('') ::all()
     $games = Session::all();
     return view('pages.cart', compact('games'));
 }
 public function postPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $item_1 = new Item();
     $item_1->setName('Item 1')->setCurrency('USD')->setQuantity(2)->setPrice('150');
     // unit price
     $item_2 = new Item();
     $item_2->setName('Item 2')->setCurrency('USD')->setQuantity(4)->setPrice('70');
     $item_3 = new Item();
     $item_3->setName('Item 3')->setCurrency('USD')->setQuantity(1)->setPrice('20');
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1, $item_2, $item_3));
     $amount = new Amount();
     $amount->setCurrency('USD')->setTotal(580);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment.status'))->setCancelUrl(URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
         //            echo'hello';
         //            print_r($test);die;
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Some error occur, sorry for inconvenient');
         }
     }
     if (is_array($payment->getLinks()) || is_object($payment->getLinks())) {
         foreach ($payment->getLinks() as $link) {
             echo 'reached';
             if ($link->getRel() == 'approval_url') {
                 $redirect_url = $link->getHref();
                 break;
             }
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     dd(Session::all());
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return Redirect::route('original.route')->with('error', 'Unknown error occurred');
 }
 /**
  * Logs an API request
  *
  * @param \Illuminate\Http\Request $request     The request
  * @param array                    $sessionData User session data, if any
  *
  * @return bool
  */
 public function logRequest(Request $request, $sessionData = [])
 {
     try {
         //  Get some session data if none given, then remove any unmentionables...
         if (empty($sessionData) || !is_array($sessionData)) {
             /** @noinspection PhpUndefinedMethodInspection */
             $sessionData = Session::all();
         }
         array_forget($sessionData, ['_token', 'token', 'api_key', 'session_token', 'metadata']);
         $_cluster = Cluster::service();
         //  Add in stuff for API request logging
         $this->log(['dfe' => $this->prepareMetadata($_cluster->getInstanceName(), $request, $_cluster->getConfig('audit', [])), 'user' => $sessionData], AuditLevels::INFO, $request, $_cluster->getClusterId());
     } catch (\Exception $_ex) {
         //  Completely ignore any issues
     }
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->after(function ($request, $response) {
         $session = Session::all();
         unset($session['_token']);
         $empty_flash = true;
         if (isset($session['flash'])) {
             if (is_array($session['flash']['old']) && count($session['flash']['old']) > 0) {
                 $empty_flash = false;
             }
             if (is_array($session['flash']['new']) && count($session['flash']['new']) > 0) {
                 $empty_flash = false;
             }
         }
         if ($empty_flash) {
             unset($session['flash']);
         }
         if (count($session) >= 1) {
             return;
         }
         $response->headers->set('X-No-Session', 'yeah');
     });
 }
 public function session_all()
 {
     $value = Session::all();
     return $value;
 }
Beispiel #8
0
 protected function doCreateField($table_name, $field_name)
 {
     $field_bd = $this->getAttribute('field');
     $data = Session::all();
     if (!Session::has($table_name . '.' . $field_name)) {
         if ($field_bd && !Schema::hasColumn($table_name, $field_name)) {
             Session::push($table_name . '.' . $field_name, 'created');
             @(list($field, $param) = explode("|", $field_bd));
             Schema::table($table_name, function ($table) use($field_name, $field, $param) {
                 $field_add = $table->{$field}($field_name);
                 if ($param) {
                     $field_add->length($param);
                 }
             });
         } else {
             Session::push($table_name . '.' . $field_name, 'created');
         }
     }
 }
 public function seesess()
 {
     return dd(Session::all());
 }
Beispiel #10
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     dd($request->all());
     Session::put('fname', 'hasha');
     dd(Session::all());
 }
Beispiel #11
0
 /**
  * Get all key-value pairs from storage.
  *
  * @return array
  */
 public function getAll()
 {
     return Session::all();
 }
 protected function assertSessionHasNoFlashData()
 {
     $all_session = Session::all();
     $this->assertFalse(isset($all_session['flash']));
 }
 public function dump()
 {
     dd(Session::all());
 }