public function getSuccessPayment() { $gateway = Omnipay::create('PayPal_Express'); $gateway->setUsername(ENV('PAYPAL_USERNAME')); $gateway->setPassword(ENV('PAYPAL_PASSWORD')); $gateway->setSignature(ENV('PAYPAL_SIGNATURE')); $gateway->setTestMode(ENV('PAYPAL_TEST')); $params = Session::get('params'); $response = $gateway->completePurchase($params)->send(); $paypalResponse = $response->getData(); if (isset($paypalResponse['PAYMENTINFO_0_ACK']) && $paypalResponse['PAYMENTINFO_0_ACK'] === 'Success') { $user = Auth::user(); // Assign Product to User $product = Product::find($params['product_id']); $user->products()->save($product, ['payment_type' => $params['payment_type'], 'amount' => $params['amount']]); foreach ($product->courses as $course) { $user->courses()->save($course); } // Assign Student Role to User if (!$user->hasRole('starter')) { $user->assignRole('starter'); } $this->dispatch(new SendPurchaseConfirmationEmail($user, $product)); return redirect()->route('thanks', $product->slug)->withSuccess('Your purchase of ' . $product->name . ' was successful.'); } else { return redirect('purchase')->withErrors('Purchase failed.'); } }
/** * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function create() { $tagCollection = Tag::where('count', '>=', ENV('SUPPOSED_TAGS', 5))->get(); $tags = $tagCollection->lists('name', 'id'); $countUserQuizzes = $this->repository->countUserQuizzes(); return view('Quiz.create', compact('tags', 'countUserQuizzes')); }
/** * Display a listing of the resource. * * @return Response */ public static function index($id, array $data = ['y' => 0]) { $challenge = Challenge::find($id); $challenge_name = $challenge->name; $group = Group::where('challenge_id', '=', $id)->get()->toArray(); $teamRound = Round::where('challenge_id', '=', $id)->orderBy('team_id', 'DESC')->get()->toArray(); $countTeamRound = count($teamRound); $countGroup = count($group) + $data['y']; $div = $countTeamRound / $countGroup; $p = 0; for ($i = $data['y']; $i <= count($teamRound) - 1; $i++) { if (!Groupsta::where('round_id', '=', $teamRound[$i]['id'])->first()) { Groupsta::create(['round_id' => $teamRound[$i]['id'], 'group_id' => $group[$p]['id'], 'challenge_id' => $id]); } if ($i == $countGroup - 1) { GroupstaController::index($id, $data = ['y' => $i + 1]); break; } $p++; } if (!ENV('DEVELOP')) { $data = GroupstaController::pagination($id); $dataG = []; $dataG += ['' => '-- Seleciona Grupo --']; $datagro = Group::where('challenge_id', '=', $id)->lists('name', 'id')->toArray(); $dataG += $datagro; return view('groupsstage.index', compact('data', 'challenge_name', 'dataG')); } }
/** * @return \Illuminate\View\View */ public function create() { $tagCollection = Tag::where('count', '>=', ENV('SUPPOSED_TAGS', 5))->get(); $tags = $tagCollection->lists('name', 'id'); $countUserPosts = $this->repository->countUserPosts(); flash()->info(trans('messages.createLang')); return view('posts.create', compact('tags', 'countUserPosts')); }
public function handlePayment(Request $request) { $amount = 0; $product = Product::find($request->product_id); $amount = $amount + $product->price; $amount = number_format($amount / 100, 2); switch ($request->provider) { case 'stripe': $gateway = Omnipay::create('Stripe'); $token = $request->stripeToken; $params = ['amount' => $amount, 'currency' => 'USD', 'token' => $token, 'payment_type' => 'stripe', 'email' => Auth::user()->email, 'description' => $product->name]; $gateway->setApiKey(ENV('STRIPE_SECRET')); break; case 'paypal': $gateway = Omnipay::create('PayPal_Express'); $params = ['cancelUrl' => 'https://40daystartup.com/purchase', 'returnUrl' => ENV('PAYPAL_RETURN'), 'description' => $product->name, 'amount' => $amount, 'currency' => 'USD', 'product_id' => $product->id, 'payment_type' => 'paypal']; $gateway->setUsername(ENV('PAYPAL_USERNAME')); $gateway->setPassword(ENV('PAYPAL_PASSWORD')); $gateway->setSignature(ENV('PAYPAL_SIGNATURE')); $gateway->setTestMode(ENV('PAYPAL_TEST')); Session::put('params', $params); Session::save(); break; default: # code... break; } //$response = $gateway->purchase($params)->send(); $payment = $gateway->purchase($params); $data = $payment->getData(); $data['receipt_email'] = Auth::user()->email; $data['metadata'] = ['email' => Auth::user()->email, 'user_id' => Auth::user()->id]; $response = $payment->sendData($data); if ($response->isSuccessful()) { $user = Auth::user(); // Assign Product to User $user->products()->save($product, ['payment_type' => $params['payment_type'], 'amount' => $params['amount']]); foreach ($product->courses as $course) { $user->courses()->save($course); } // Assign Student Role to User if (!$user->hasRole('starter')) { $user->assignRole('starter'); } // Fire off purchase email $this->dispatch(new SendPurchaseConfirmationEmail($user, $product)); Session::flush(); return redirect()->route('thanks', $product->slug)->withSuccess('Your purchase of ' . $product->name . ' was successful.'); } elseif ($response->isRedirect()) { $response->redirect(); } else { return redirect('purchase')->withErrors([$response->getMessage()]); } }
public function run() { $userData = []; $userData['email'] = '*****@*****.**'; $userData['first_name'] = 'Test'; $userData['last_name'] = 'User'; $userData['display_name'] = 'test_user'; $userData['password'] = Hash::make(ENV('APP_KEY', 'password')); $userData['owner'] = true; User::create($userData); }
/** * Execute the console command. * * @return mixed */ public function handle() { $variables = []; $file = base_path() . '/.env'; if (!file_exists($file)) { $this->error('Missing environment file! It appears that you have not installed this panel correctly.'); exit; } $envContents = file_get_contents($file); if (!env('SERVICE_AUTHOR', false)) { $this->info('No service author set, setting one now.'); $variables['SERVICE_AUTHOR'] = env('SERVICE_AUTHOR', (string) Uuid::generate(4)); } // DB info if ($this->confirm('Update database host? [' . env('DB_HOST') . ']')) { $variables['DB_HOST'] = $this->anticipate('Database Host (usually \'localhost\' or \'127.0.0.1\')', ['localhost', '127.0.0.1', env('DB_HOST')]); } if ($this->confirm('Update database port? [' . env('DB_PORT') . ']')) { $variables['DB_PORT'] = $this->anticipate('Database Port', [3306, env('DB_PORT')]); } if ($this->confirm('Update database name? [' . env('DB_DATABASE') . ']')) { $variables['DB_DATABASE'] = $this->anticipate('Database Name', ['pterodactyl', 'homestead', ENV('DB_DATABASE')]); } if ($this->confirm('Update database username? [' . env('DB_USERNAME') . ']')) { $variables['DB_USERNAME'] = $this->anticipate('Database Username', [env('DB_USERNAME')]); } if ($this->confirm('Update database password?')) { $variables['DB_PASSWORD'] = $this->secret('Database User\'s Password'); } // Other Basic Information if ($this->confirm('Update panel URL? [' . env('APP_URL') . ']')) { $variables['APP_URL'] = $this->anticipate('Enter your current panel URL (include http or https).', [env('APP_URL', 'http://localhost')]); } if ($this->confirm('Update panel timezone? [' . env('APP_TIMEZONE') . ']')) { $this->line('The timezone should match one of the supported timezones according to http://php.net/manual/en/timezones.php'); $variables['APP_TIMEZONE'] = $this->anticipate('Enter the timezone for this panel to run with', \DateTimeZone::listIdentifiers(\DateTimeZone::ALL)); } $bar = $this->output->createProgressBar(count($variables)); $this->line('Writing new environment configuration to file.'); foreach ($variables as $key => $value) { $newValue = $key . '=' . $value; if (preg_match_all('/^' . $key . '=(.*)$/m', $envContents) < 1) { $envContents = $envContents . "\n" . $newValue; } else { $envContents = preg_replace('/^' . $key . '=(.*)$/m', $newValue, $envContents); } $bar->advance(); } file_put_contents($file, $envContents); $bar->finish(); echo "\n"; }
public function handlePayment(Request $request) { if (Auth::check()) { $user = Auth::user(); } else { $userSearch = User::where('email', $request->email)->first(); if (!$userSearch) { $user = User::create(['name' => $request->name, 'email' => $request->email, 'password' => bcrypt($request->email)]); } else { $user = $userSearch; } } $product = Product::find($request->product_id); $amount = number_format($product->price / 100, 2); switch ($request->provider) { case 'stripe': $gateway = Omnipay::create('Stripe'); $token = $request->stripeToken; $params = ['amount' => $amount, 'currency' => 'USD', 'token' => $token, 'payment_type' => 'stripe', 'receipt_email' => $user->email, 'description' => $product->name]; $gateway->setApiKey(ENV('STRIPE_SECRET')); break; case 'paypal': $gateway = Omnipay::create('PayPal_Express'); $params = ['cancelUrl' => 'https://makerscabin.com/purchase', 'returnUrl' => ENV('PAYPAL_RETURN'), 'description' => $product->name, 'amount' => $amount, 'currency' => 'USD', 'product_id' => $product->id, 'payment_type' => 'paypal']; $gateway->setUsername(ENV('PAYPAL_USERNAME')); $gateway->setPassword(ENV('PAYPAL_PASSWORD')); $gateway->setSignature(ENV('PAYPAL_SIGNATURE')); $gateway->setTestMode(ENV('PAYPAL_TEST')); Session::put('params', $params); Session::save(); break; default: # code... break; } $payment = $gateway->purchase($params); $data = $payment->getData(); $data['receipt_email'] = $user->email; $data['metadata'] = ['email' => $user->email, 'user_id' => $user->id]; $response = $payment->sendData($data); if ($response->isSuccessful()) { $this->dispatch(new SendPurchaseConfirmationEmail($user, $product)); $order = Order::create(['user_id' => $user->id, 'product_id' => $product->id, 'payment_method' => 'stripe', 'amount' => $product->price]); return redirect()->route('receipt', $product->slug)->withSuccess('Your purchase of ' . $product->name . ' was successful.'); } elseif ($response->isRedirect()) { $response->redirect(); } else { return redirect('purchase')->withErrors([$response->getMessage()]); } }
public static function index($id, array $data = ['y' => 0, 'time_start' => 0, 'time_end' => 0]) { $challenge = Challenge::find($id); $challenge_name = $challenge->name; $cha = Challenge::listGroup(); $flag = true; // if(!Round::where('challenge_id','=',$id)->first()){ $stage = Stage::where('challenge_id', '=', $id)->where('back', '=', 0)->where('active', '=', 1)->get()->toArray(); $team = Team::where('challenge_id', '=', $id)->where('active', '=', 1)->orderBy('id', 'RAND()')->get()->toArray(); $numStage = count($stage) + $data['y']; if ($data['time_start'] == 0 && $data['time_end'] == 0) { $date = new DateTime(Settings::ScheTrial()); $time = 0; $pag = false; $hora_start = $date->format('H:i:s'); $hora_end = date('H:i:s', strtotime($date->format('H:i:s') . '+' . $time . ' minute')); $date_end = new DateTime($hora_end); $time_dos = Settings::durationTrial(); $hora_start = strtotime('+' . $time_dos . ' minute', strtotime($date_end->format('H:i:s'))); $hora_start = date('H:i:s', $hora_start); } else { $date = new DateTime($data['time_start']); $time = 0; $pag = false; $hora_start = $date->format('H:i:s'); $hora_end = date('H:i:s', strtotime($date->format('H:i:s') . '+' . $time . ' minute')); $date_end = new DateTime($hora_end); $time_dos = Settings::durationTrial(); $hora_start = strtotime('+' . $time_dos . ' minute', strtotime($date_end->format('H:i:s'))); $hora_start = date('H:i:s', $hora_start); } $p = 0; for ($i = $data['y']; $i <= count($team) - 1; $i++) { if (!Round::where('team_id', '=', $team[$i]['id'])->first()) { Round::create(['team_id' => $team[$i]['id'], 'challenge_id' => $team[$i]['challenge_id'], 'schedule_start' => $hora_end, 'schedule_end' => $hora_start, 'stage_id' => $stage[$p]['id']]); } if ($i == $numStage - 1) { RoundController::index($id, $data = ['y' => $i + 1, 'time_start' => $hora_start, 'time_end' => $hora_end]); break; } $p++; } // } if (!ENV('DEVELOP')) { $pag = RoundController::pagination($id); $flag = true; return view('round.index', compact('flag', 'pag', 'cha', 'challenge_name', 'id')); } }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $this->command->info('Seeding default category'); $this->call('CategoriesTableSeeder'); $this->command->info('Seeding options from configs'); $this->call('OptionsTableSeeder'); if (ENV('APP_ENV') == 'testing' && ENV('DB_CONNECTION') == 'testing') { $this->command->info('Seeding TEST DATA'); $this->call('TestUserSeeder'); $this->call('TestPostSeeder'); $this->call('TestPageSeeder'); } Model::reguard(); }
public function userData(array $override = []) { $userData = []; $userData['email'] = '*****@*****.**'; $userData['first_name'] = 'User'; $userData['last_name'] = 'Test'; $userData['display_name'] = 'test_user'; $userData['password'] = Hash::make(ENV('APP_KEY', 'password')); $userData['owner'] = true; if (!empty($override)) { foreach ($override as $key => $value) { $userData[$key] = $value; } } return $userData; }
public static function start() { $lastRun = fopen(ENV('LAST_RUN'), 'c+'); $now = Carbon::now(); if (filesize(ENV('LAST_RUN')) == 19 && Carbon::parse(fgets($lastRun)) < $now->endOfWeek()) { fclose($lastRun); return false; } else { fwrite($lastRun, $now->startOfWeek()); fclose($lastRun); Week::create(); } $users = User::prefsFirst(); //$users = User::whereIn('name', ['Sean Fraser', 'John Hodges', 'Warren Wilansky'])->with('taskPrefs')->get(); $tasks = Task::all()->pluck('id')->diff(TaskExemption::common($users->pluck('id')))->shuffle(); static::run($tasks, $users, 0); }
public function getSuccessPayment() { $gateway = Omnipay::create('PayPal_Express'); $gateway->setUsername(ENV('PAYPAL_USERNAME')); $gateway->setPassword(ENV('PAYPAL_PASSWORD')); $gateway->setSignature(ENV('PAYPAL_SIGNATURE')); $gateway->setTestMode(ENV('PAYPAL_TEST')); //dd(Auth::user()); $tracker = DB::table('paypal_tracking')->where('user_id', Auth::user()->id)->where('purchased', 0)->first(); $series = Series::find($tracker->series_id); $amount = number_format($series->price / 100, 2); $params = ['cancelUrl' => 'https://makerscabin.com/purchase', 'returnUrl' => ENV('PAYPAL_RETURN'), 'description' => $series->name, 'amount' => $amount, 'currency' => 'USD', 'series_id' => $series->id, 'payment_type' => 'paypal']; //$params = Session::get('params'); //dd($params); $response = $gateway->completePurchase($params)->send(); //dd($response); $paypalResponse = $response->getData(); if (isset($paypalResponse['PAYMENTINFO_0_ACK']) && $paypalResponse['PAYMENTINFO_0_ACK'] === 'Success') { $user = Auth::user(); DB::table('paypal_tracking')->where('user_id', $user->id)->where('series_id', $series->id)->update(['purchased' => 1]); //dd($params); // Assign Product to User $series = Series::find($params['series_id']); $user->series()->save($series, ['payment_type' => $params['payment_type'], 'amount' => $params['amount']]); // foreach($product->schools as $school) { // $user->schools()->save($school); // } // Assign Student Role to User // if (! $user->hasRole('student')) // $user->assignRole('student'); $this->dispatch(new SendPurchaseConfirmationEmail($user, $series)); //Session::flush(); return redirect()->route('thanks', $series->slug)->withSuccess('Your purchase of ' . $series->name . ' was successful.'); } else { return redirect('purchase')->withErrors('Purchase failed.'); } }
function obtenerWhere($idFormula, $tabla, $campoFecha, $fechaInicio, $fechaFin) { // a la condicion de la consulta le debemos adicionar una fecha de corte // y el id de la compañia actual // para adicionar el id de la compania, primero verificamos si en la tabla existe ese campo $consulta = DB::table('information_schema.COLUMNS')->select(DB::raw('COLUMN_NAME'))->where('TABLE_SCHEMA', '=', ENV('DB_DATABASE', 'sisoft'))->where('TABLE_NAME', '=', $tabla)->where('COLUMN_NAME', 'like', '%idCompania%')->get(); $datowhere = ''; // si la tabla tiene campo de id de compania, armamos una condicion con el id de compania de la session actual sino la dejamos en blanco $datowhere = isset(get_object_vars($consulta[0])["COLUMN_NAME"]) ? get_object_vars($consulta[0])["COLUMN_NAME"] . ' = ' . \Session::get("idCompania") . ' AND ' : ''; // Si el usuario asocio una fecha de corte, la aplicamos en la condicion $datowhere .= ($campoFecha != null and $campoFecha != '') ? '(' . $campoFecha . ' >= "' . $fechaInicio . '" and ' . $campoFecha . ' <= "' . $fechaFin . '") AND ' : ''; $condicion = DB::table('cuadromandocondicion')->select(DB::raw('parentesisInicioCuadroMandoCondicion, campoCuadroMandoCondicion, operadorCuadroMandoCondicion, valorCuadroMandoCondicion, parentesisFinCuadroMandoCondicion, conectorCuadroMandoCondicion'))->where('CuadroMandoFormula_idCuadroMandoFormula', "=", $idFormula)->get(); foreach ($condicion as $cond => $where) { // cada valor es un nuevo array de tipo StdClass, el cual debemos convertir en array php $datosCondicion = get_object_vars($where); $like = $datosCondicion["operadorCuadroMandoCondicion"] == 'like' ? '%' : ''; $tipoString = substr($datosCondicion["valorCuadroMandoCondicion"], 0, 1) == '(' ? '' : '"'; // concatenamos caa campo separado por coma $datowhere .= $datosCondicion["parentesisInicioCuadroMandoCondicion"] . ' ' . $datosCondicion["campoCuadroMandoCondicion"] . ' ' . $datosCondicion["operadorCuadroMandoCondicion"] . ' ' . $tipoString . $like . $datosCondicion["valorCuadroMandoCondicion"] . $like . $tipoString . ' ' . $datosCondicion["parentesisFinCuadroMandoCondicion"] . ' ' . $datosCondicion["conectorCuadroMandoCondicion"] . ' '; } // quitamos el conector logico (AND , OR) final si existe $datowhere = substr($datowhere, 0, strlen($datowhere) - 4); return $datowhere; }
<?php return ['driver' => env('SESSION_DRIVER', 'file'), 'lifetime' => 120, 'expire_on_close' => false, 'encrypt' => false, 'files' => storage_path('framework/sessions'), 'connection' => null, 'table' => 'sessions', 'lottery' => [2, 100], 'cookie' => 'laravel_session', 'path' => '/', 'domain' => ENV('APP_TOP_DOMAIN', null), 'secure' => false];
<?php return ['client_id' => env('LARADIT_CLIENT_ID'), 'client_secret' => env('LARADIT_CLIENT_SECRET'), 'oauth_redirect_uri' => env('LARADIT_OAUTH_CLIENT_REDIRECT_URL'), 'user_agent' => env('LARADIT_USER_AGENT', 'laradit'), 'reddit_username' => env('LARADIT_REDDIT_USERNAME'), 'reddit_password' => ENV('LARADIT_REDDIT_PASSWORD')];
/** * @group admin * @group user * @group crud */ public function testUserCRUDPage() { $goodData = ['first_name' => 'Second Test', 'last_name' => 'User', 'display_name' => 'second_test_user', 'email' => '*****@*****.**', 'password' => ENV('APP_KEY', 'password'), 'password_confirmation' => ENV('APP_KEY', 'password')]; $this->setCreatePath('/admin/users/create')->setModel('User')->setData($goodData)->setEditPath('/admin/users/2/edit')->CRUDModel()->setAdminPage('/admin/users', 'Second Test User')->setAdminPage('/admin/users/2', 'Second Test User')->viewItem('/admin/users/2', 'Second Test User')->viewItem('/admin/users/2', '*****@*****.**')->clickAdminPanel('/admin/users', 'Delete'); // $this->clickAdminPanel('/admin/users/2/delete', 'Delete Forever'); }
<?php return ['hosts' => array_filter(explode('|', ENV('ELASTICSEARCH_HOSTS', ''))), 'index' => ENV('ELASTICSEARCH_INDEX', 'index'), 'fuzziness' => 2, "prefix_length" => 2, "max_expansions" => 100];
<?php return ['driver' => env('MAIL_DRIVER', 'smtp'), 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'port' => env('MAIL_PORT', 587), 'from' => ['address' => env('SENDER_ADDRES'), 'name' => ENV('SENDER_MAIL')], 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'sendmail' => '/usr/sbin/sendmail -bs', 'pretend' => false];
<?php $currentSubmenu = '/workreport'; $host = ENV('DB_HOST'); ?> @extends('core.bsdiagram') @section('title') <div class="title">REPORTS</div> @stop @section('content') <link rel="stylesheet" href="/common/css/admin.css"> <script type="text/javascript"> $(function(){ var ebtoken = $('meta[name="_token"]').attr('content'); $.ajaxSetup({ headers: { 'X-XSRF-Token': ebtoken } }); $('#pageheader').css('display', 'none'); $('#cboReports').change(); _report.host = <?php echo $host; ?> }); var _report = {
/** * @group user * @group login */ public function testUserLoginPost() { $userData = ['email' => '*****@*****.**', 'password' => ENV('APP_KEY', 'password')]; $this->route('POST', 'login.post', $userData)->isOk(); }
public function createDirectories() { foreach ($this->DIRECTORIES as $dir) { if (file_exists(ENV("BASE_PATH") . $dir)) { continue; } else { mkdir(ENV("BASE_PATH") . $dir, 0644); //Notice the permission that is set and if it's OK! } } }
public static function getindex($id) { $challenge = Challenge::find($id); $challenge_name = $challenge->name; $dataGrouptwo = Group::where('challenge_id', '=', $id)->where('active', '=', 1)->get(); $dataGroup = Group::where('challenge_id', '=', $id)->where('active', '=', 1)->get()->toArray(); for ($i = 0; $i <= count($dataGroup) - 1; $i++) { CombatRoundController::functionTwo(['group_id' => $dataGroup[$i]['id'], 'stage_id' => $dataGroup[$i]['stage_id'], 'challenge_id' => $id]); } if (!ENV('DEVELOP')) { return view('combatround/round2', compact('dataGrouptwo', 'challenge_name')); } }
<?php $optionTabs = []; $optionTabs[] = ['slug' => 'general', 'options' => ['site_title' => ENV('SITE_TITLE', 'MonkBlog'), 'tagline' => ENV('SITE_TAGLINE', 'Just another MonkBlog'), 'monk_version' => ENV('SITE_VERSION', '1.5@beta')]]; $optionTabs[] = ['slug' => 'contact_info', 'options' => ['email' => ENV('SITE_CONTACT_EMAIL', '*****@*****.**'), 'facebook' => ENV('SITE_CONTACT_FACEBOOK', 'monkblog'), 'twitter' => ENV('SITE_CONTACT_TWITTER', 'monkblog')]]; $optionTabs[] = ['slug' => 'themes', 'options' => ['current_theme' => 'monk']]; return $optionTabs;
<?php return ['default' => env('KEYSTONE_DRIVER', 'native'), 'connections' => ['native' => ['driver' => 'native', 'vendor' => env('KEYSTONE_VENDOR', 'mreschke/keystone'), 'host' => env('KEYSTONE_HOST', '127.0.0.1'), 'port' => env('KEYSTONE_PORT', 6379), 'database' => env('KEYSTONE_DATABASE', 0), 'prefix' => env('KEYSTONE_PREFIX', 'keystone:'), 'root_namespace' => env('KEYSTONE_ROOT_NAMESPACE', 'mreschke/foundation'), 'metadata_namespace' => env('KEYSTONE_METADATA_NAMESPACE', 'mreschke/keystone'), 'path' => env('KEYSTONE_PATH'), 'max_redis_size' => env('KEYSTONE_MAX_REDIS_SIZE', 4096)], 'remote' => ['driver' => 'http', 'vendor' => env('KEYSTONE_VENDOR', 'mreschke/keystone'), 'api_url' => env('KEYSTONE_API_URL'), 'api_version' => env('KEYSTONE_API_VERSION', 'v1'), 'api_key' => ENV('KEYSTONE_API_KEY'), 'api_secret' => env('KEYSTONE_API_SECRET'), 'cache' => env('KEYSTONE_API_CACHE', false)]], 'server' => env('KEYSTONE_SERVER', false), 'server_url' => env('KEYSTONE_SERVER_URL')];
/** * Execute the job. * * @return void */ public function handle() { //if(count($this->$param) >= 6){ $task_id = $this->param['task_id']; $report_id = $this->param['report_id']; $facility_id = $this->param['facility_id']; $date_type = $this->param['date_type']; $from_date = $this->param['from_date']; $to_date = $this->param['to_date']; $email = $this->param['email']; $exportType = "PDF"; if ($date_type == "day") { $date = date('Y-m-d'); $from_date = date('Y/m/d', strtotime($date . ' -1 day')) . ""; $to_date = $from_date; } $fs = explode("-", $from_date); if (count($fs) >= 3) { $from_date = "{$fs['2']}/{$fs['0']}/{$fs['1']}"; } $fs = explode("-", $to_date); if (count($fs) >= 3) { $to_date = "{$fs['2']}/{$fs['0']}/{$fs['1']}"; } $this->fff(); if (filter_var($email, FILTER_VALIDATE_EMAIL)) { $host = "http://" . ENV('DB_HOST'); switch ($report_id) { case 1: $url = $host . "/report/export.php?export=PDF&date_from={$from_date}&date_to={$to_date}&facility_id={$facility_id}"; break; case 2: $url = $host . "/report/summaryVolumeReport.blade.php?export=PDF&startDate={$from_date}&endDate={$to_date}&facility_id={$facility_id}"; break; case 3: $url = $host . "/report/WelltestSummaryReport.blade.php?export=PDF&startDate={$from_date}&endDate={$to_date}&facility_id={$facility_id}"; break; case 4: $url = $host . "/report/MorningReport_report.blade.php?export=PDF&date={$from_date}&facility_id={$facility_id}"; break; } file_get_contents($url); try { $mailFrom = env('MAIL_USERNAME'); $content = "Please see attached file.<br>You also can view live report by click this link: {$url}"; //"Please see attached file"; $data = ['content' => $content]; $filename = $host . "/report/output.pdf"; $subjectName = "Report sent from Workflow"; $ret = Mail::send('front.sendmail', $data, function ($message) use($email, $subjectName, $mailFrom, $filename) { $message->from($mailFrom, 'Your Application'); $message->to($email)->subject($subjectName); $message->attach($filename); }); if ($ret === 1) { \Log::info("Email sent successfully"); } else { \Log::info($ret); } } catch (Swift_RfcComplianceException $e) { \Log::info($e->getMessage()); } } if ($task_id > 0) { $objRun = new run(null); $objRun->finalizeTask($task_id, 1, null, null); } //exit(); /* }else{ $facility_id=$_REQUEST["facility_id"]; $from_date=$_REQUEST["date_from"]; $to_date=$_REQUEST["date_to"]; $exportType = $_REQUEST["export"]; } ini_set ( "allow_url_include", true ); if (isset ( $exportType )) { $varurl = 'http://localhost:8080/JavaBridge/java/Java.inc'; require_once $varurl; $System = java ( "java.lang.System" ); // echo $System->getProperties(); try { java ( "java.lang.Class" )->forName ( "com.mysql.jdbc.Driver" ); $connection = java ( "java.sql.DriverManager" )->getConnection ( "jdbc:mysql://localhost/eb", "root", "" ); $root = realpath ( "." ); $in = $root . "/NewMain.jrxml"; $report = java ( "net.sf.jasperreports.engine.JasperCompileManager" )->compileReport ( $in ); $dateFormat = new java ( "java.text.SimpleDateFormat", "yy/MM/dd" ); $d = $dateFormat->parse ( $from_date ); $d2 = $dateFormat->parse ( $to_date ); $params = new java ( "java.util.HashMap" ); $params->put ( "facility_id", intval ( $facility_id ) ); // dây là 1 param $params->put ( "begin_date", new java ( "java.sql.Date", $d->getTime () ) ); $params->put ( "end_date", new java ( "java.sql.Date", $d2->getTime () ) ); $params->put ( "SUBREPORT_DIR", $root . "/sub/" ); $print = java ( "net.sf.jasperreports.engine.JasperFillManager" )->fillReport ( $report, $params, $connection ); $print->setProperty("net.sf.jasperreports.export.xls.ignore.graphics", "true"); $contentType = "text/Html"; $out = 'out.html'; if ($exportType == "PDF") { java_set_file_encoding ( "ISO-8859-1" ); $contentType = "application/pdf"; // export Pdf $out = $root . "/output.pdf"; java ( "net.sf.jasperreports.engine.JasperExportManager" )->exportReportToPdfFile ( $print, $out ); } elseif ($exportType == "HTML") { // export Pdf $out = $root . "/output.Html"; $contentType = "text/Html"; java ( "net.sf.jasperreports.engine.JasperExportManager" )->exportReportToHtmlFile ( $print, $out ); } elseif ($exportType == "Excel") { $out = $root . "/output.xls"; $contentType = "application/vnd.ms-excel"; $xlsExporter = new java ( "net.sf.jasperreports.engine.export.JRXlsExporter" ); $JRXlsExporterParameter = java ( "net.sf.jasperreports.engine.export.JRXlsExporterParameter" ); $xlsExporter->setParameter ( $JRXlsExporterParameter->JASPER_PRINT, $print ); $xlsExporter->setParameter ( $JRXlsExporterParameter->OUTPUT_FILE, new java ( "java.io.File", $out ) ); // $xlsExporter->setParameter($JRXlsExporterParameter->IS_WHITE_PAGE_BACKGROUND, true); $xlsExporter->exportReport (); } header ( "Content-type: " . $contentType ); readfile ( $out ); // unlink($out); } catch ( Exception $ex ) { echo "<b>Error...:</b>" . $ex->getCause (); } echo "done"; } */ }
<?php return ['name' => ENV('APP_NAME')];
<?php namespace GlobalTechnology\MPDDashboard; /** * @param string $var * @param mixed $default * * @return string */ function ENV($var, $default = '') { return array_key_exists($var, $_SERVER) ? $_SERVER[$var] : $default; } return array('application' => array('version' => '1.0.5', 'project_name' => ENV('PROJECT_NAME', 'mpd-dashboard-app'), 'environment' => ENV('ENVIRONMENT', 'production')), 'pgtservice' => array('enabled' => (bool) ENV('PGTSERVICE_ENABLED', false), 'callback' => ENV('PGTSERVICE_CALLBACK', 'https://agapeconnect.me/casLogin.aspx'), 'endpoint' => ENV('PGTSERVICE_ENDPOINT', 'https://agapeconnect.me/DesktopModules/AgapeConnect/casauth/pgtcallback.asmx/RetrievePGTCallback'), 'username' => ENV('PGTSERVICE_USERNAME', ''), 'password' => ENV('PGTSERVICE_PASSWORD', '')), 'cas' => array('hostname' => ENV('CAS_HOSTNAME', 'thekey.me'), 'port' => ENV('CAS_PORT', 443), 'context' => ENV('CAS_CONTEXT', 'cas')), 'redis' => array('hostname' => ENV('REDIS_PORT_6379_TCP_ADDR', false), 'port' => 6379, 'db' => ENV('REDIS_DB_INDEX', 2)), 'cas-auth-api' => array('endpoint' => ENV('CAS_AUTH_API', '')), 'mpd-dashboard' => array('endpoint' => ENV('MPD_DASHBOARD_API', '')));
<?php return ['base_uri' => ENV('TRANSFERSH_BASE_URI', 'transfer.sh'), 'timeout' => ENV('TRANSFERSH_BASE_URI', '2.0')];
<?php return ['client_id' => ENV('APIGENCI_ID'), 'client_secret' => ENV('APIGENCI_SECRET')];