/** * Method for upload files * * @param Request $request * @param MediaRepositoryInterface $repositoryInterface * @return string */ public function upload(Request $request, MediaRepositoryInterface $repositoryInterface) { \Debugbar::disable(); $id = $repositoryInterface->create($request->file('file'), null, null); $answer = array('answer' => 'File transfer completed', 'id' => $id); $json = json_encode($answer); return $json; }
public function getTemplate() { \Debugbar::disable(); if (\App::environment() != 'prod') { $content = \File::get(base_path() . '/angular/app/views/modules' . \Input::get('tmp')); } else { $content = \File::get(base_path() . '/public/app/views/modules' . \Input::get('tmp')); } $response = \Response::make($content); return $response; }
/** * Execute the command. * * @return void */ public function handle() { \Debugbar::disable(); //Get a list of allDuo Users subscribed to the DuoRegisteredUsersReport $users = User::whereHas('reports', function ($query) { $query->where('name', 'DuoRegisteredUsersReport'); })->get(); //Loop each user to generate report foreach ($users as $recipient) { $this->dispatch(new GenerateRegisteredDuoUsersReport($recipient)); // \Log::debug('Message will be sent to:',[$recipient->email]); } }
public function countdown() { $api_uri = 'http://icampus.faithpromise.org/api/v1/events/current'; $key = 'icampus_countdown'; $is_local = App::environment('local'); if ($is_local) { \Debugbar::disable(); $test_start = Carbon::now(); $test_start_local = $test_start->copy()->setTimezone('America/New_York'); $human_start_time_format = $test_start->minute == 0 ? 'ga' : 'g:ia'; $human_start_format = 'D ' . $human_start_time_format; $test = ['start_utc' => $test_start->timestamp * 1000, 'start' => $test_start_local->timestamp * 1000, 'is_live' => false, "human_start" => $test_start_local->format($human_start_format), "human_start_time" => $test_start_local->format($human_start_time_format)]; return response(json_encode($test)); } // LATER: Test out the cache $countdown = Cache::get($key); $http_client = new HttpClient(); if ($countdown === null or App::environment('local')) { $countdown = []; $icampus_result = $http_client->get($api_uri, ['connect_timeout' => 5]); try { $data = json_decode($icampus_result->getBody()); if ($icampus_result->getStatusCode() !== 200 or !isset($data->meta->status) or $data->meta->status !== 200) { // LATER: Log this throw new \Exception('Call to iCampus API was not successful'); } } catch (\Exception $e) { $expire = Carbon::now()->addMinutes(5); return response('', 500)->header('Expires', $expire); } $countdown['start_utc'] = Carbon::parse($data->response->item->eventStartTime); $countdown['start_local'] = $countdown['start_utc']->copy()->setTimezone('America/New_York'); $countdown['expire_utc'] = $countdown['start_utc']->copy()->addMinutes(60); $human_start_time_format = $countdown['start_local']->minute == 0 ? 'ga' : 'g:ia'; $human_start_format = 'D ' . $human_start_time_format; $countdown['json'] = json_encode(array("start_utc" => $countdown['start_utc']->timestamp * 1000, "start" => $countdown['start_local']->timestamp * 1000, "is_live" => $data->response->item->isLive, "human_start" => $countdown['start_local']->format($human_start_format), "human_start_time" => $countdown['start_local']->format($human_start_time_format))); Cache::put($key, $countdown, $countdown['expire_utc']); } return response($countdown['json'])->header('Expires', $countdown['expire_utc']->format('D, d M Y H:i:s \\G\\M\\T')); }
public function index() { if (class_exists('\\Debugbar')) { \Debugbar::disable(); } switch ($this->getMethod()) { case static::MethodPost: $this->parameters = $_POST; break; case static::MethodGet: $this->parameters = $_GET; break; default: $this->parameters = Input::all(); } if ($this->check()) { $this->beforeHandle(); if (!$this->cache) { $this->cache = new BasicAPICacher(); } if ($cache = $this->cache->read($this)) { $this->response = $cache; $this->debugMessage('缓存命中'); } else { $this->handle(); $this->cache->save($this); } $this->afterHandle(); } else { $this->debugMessage('验证check()函数没有通过'); } return $this->response(); }
<?php \Debugbar::disable(); Route::get("buscar", "InfoInvestController@getIndex"); Route::get("test1", function () { return view("index"); }); Route::get("test2", function () { return view("form"); }); Route::get("redirecionar", function () { if (\Input::get('url') != null) { echo "Decidir o que fazer o acesso para " . \Input::get('url'); sleep(1); return redirect(\Input::get('url')); } else { return array('erro' => true, 'message' => "Url inválida!"); } });
public function tryThisOne() { \Debugbar::disable(); $location = (array) App\Location::random(); return view('locations.try-this', ['location' => $location]); }
public function getFilealbum($parentId = null) { \Debugbar::disable(); $fileResult = $this->foldercontents($parentId); if (!$fileResult['status']) { Message::error($fileResult['message']); } $maxSize = Filer::getMaxSizeAllowed() > Filer::getMaxSizePossible() ? Filer::getMaxSizePossible() : Filer::getMaxSizeAllowed(); // Convert bytes to mega $maxSize = $maxSize / 1048576; return $this->layout()->with('parentId', $parentId)->with('fileResult', $fileResult)->with('uploadMaxFilesize', $maxSize); }
/** * Exports the assets to CSV * * @author [A. Gianotto] [<*****@*****.**>] * @since [v1.0] * @return \Illuminate\Http\Response */ public function exportAssetReport() { \Debugbar::disable(); $response = new StreamedResponse(function () { // Open output stream $handle = fopen('php://output', 'w'); Asset::with('assigneduser', 'assetloc', 'defaultLoc', 'assigneduser.userloc', 'model', 'supplier', 'assetstatus', 'model.manufacturer')->orderBy('created_at', 'DESC')->chunk(500, function ($assets) use($handle) { fputcsv($handle, [trans('admin/hardware/table.asset_tag'), trans('admin/hardware/form.manufacturer'), trans('admin/hardware/form.model'), trans('general.model_no'), trans('general.name'), trans('admin/hardware/table.serial'), trans('general.status'), trans('admin/hardware/table.purchase_date'), trans('admin/hardware/table.purchase_cost'), trans('admin/hardware/form.order'), trans('admin/hardware/form.supplier'), trans('admin/hardware/table.checkoutto'), trans('admin/hardware/table.location'), trans('general.notes')]); foreach ($assets as $asset) { // Add a new row with data fputcsv($handle, [$asset->asset_tag, $asset->model->manufacturer ? $asset->model->manufacturer->name : '', $asset->model ? $asset->model->name : '', $asset->model->modelno ? $asset->model->modelno : '', $asset->name ? $asset->name : '', $asset->serial ? $asset->serial : '', $asset->assetstatus ? e($asset->assetstatus->name) : '', $asset->purchase_date ? e($asset->purchase_date) : '', $asset->purchase_cost > 0 ? Helper::formatCurrencyOutput($asset->purchase_cost) : '', $asset->order_number ? e($asset->order_number) : '', $asset->supplier ? e($asset->supplier->name) : '', $asset->assigneduser ? e($asset->assigneduser->fullName()) : '', $asset->assigneduser && $asset->assigneduser->userloc != '' ? e($asset->assigneduser->userloc->name) : ($asset->defaultLoc != '' ? e($asset->defaultLoc->name) : ''), $asset->notes ? e($asset->notes) : '']); } }); // Close the output stream fclose($handle); }, 200, ['Content-Type' => 'text/csv', 'Content-Disposition' => 'attachment; filename="assets-' . date('Y-m-d-his') . '.csv"']); return $response; }
public function __construct() { $this->middleware('auth'); \Debugbar::disable(); }
public function changePassword(Request $request) { \Debugbar::disable(); $user = auth()->guard('api')->user(); if (!Hash::check($request->get('old_password'), $user->password)) { return 1; } if ($user->update(['password' => Hash::make($request->get('password'))])) { return 2; } return 0; }
/** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Exception $e * @return \Illuminate\Http\Response */ public function render($request, Exception $e) { env('APP_DEBUG') ? \Debugbar::enable() : \Debugbar::disable(); return parent::render($request, $e); }
public function __construct() { parent::__construct(); \Debugbar::disable(); }
/** * Calcuate the number of physicians within a certain number of * miles of a ZIP code. * * @param string * @return string */ public function withinDistance(Request $request) { \Debugbar::disable(); if (!$request->has(['miles', 'zip'])) { app()->abort(404); } $location = Location::where('zip', '=', $request->zip)->get(); $lat = $location[0]->lat; $lon = $location[0]->lon; $haversineSelectStmt = $this->haversineSelect($lat, $lon); $physicians = DB::table('physicians')->select(DB::raw($haversineSelectStmt))->having('distance', '<', $request->miles)->orderBy('distance', 'asc')->get(); $count = (string) count($physicians); return json_encode(['count' => $count]); }