public function __construct(Guard $auth)
 {
     $id_site = \Session::get('id_site');
     //$credentials = Paypal_credentials::where('id_site', $id_site)->get();
     //$credentials = collect($credentials);
     //$client_id = $credentials->get('client_id');
     //$secret = Crypt::decrypt($credentials->get('secret'));
     //$secret = $credentials->get('secret');
     $client_id = Paypal_credentials::where('id_site', $id_site)->value('client_id');
     $secret = Paypal_credentials::where('id_site', $id_site)->value('secret');
     // setup PayPal api context
     //$paypal_conf = \Config::get('paypal');
     $paypal_conf = array('client_id' => $client_id, 'secret' => $secret, 'settings' => array('mode' => 'sandbox', 'http.ConnectionTimeOut' => 30, 'log.LogEnabled' => true, 'log.FileName' => storage_path() . '/logs/paypal.log', 'log.LogLevel' => 'FINE'));
     $this->_api_context = new ApiContext(new OAuthTokenCredential($paypal_conf['client_id'], $paypal_conf['secret']));
     $this->_api_context->setConfig($paypal_conf['settings']);
     $this->auth = $auth;
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $credentials = Paypal_credentials::where('id_site', $id)->get();
     return response()->json($credentials->toArray());
 }