Inheritance: extends Illuminate\Foundation\Exceptions\Handler
 public function digitalCatalogs()
 {
     $page = 'produtos';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $productsCategories = ProductsCategories::orderBy('sortorder', 'asc')->get();
     $activePrinciples = Products::addSelect(DB::raw('DISTINCT(activePrinciple)'))->where('activePrinciple', '!=', '')->orderBy('activePrinciple', 'asc')->get();
     foreach ($activePrinciples as $activePrinciple) {
         array_add($activePrinciple, 'activePrincipleSlug', str_slug($activePrinciple->activePrinciple, '-'));
     }
     $digitalCatalogs = DigitalCatalogs::orderBy('sortorder', 'asc')->paginate(3);
     $categoryChosen = "Catálogos Digitais";
     $categoryChosenSlug = "catalogos-digitais";
     return view('website.products.digitalCatalogs')->with(compact('page', 'pages', 'websiteSettings', 'productsCategories', 'digitalCatalogs', 'categoryChosen', 'categoryChosenSlug', 'activePrinciples', 'activePrincipleChosenSlug'));
 }
 public function testNotFoundRender()
 {
     $path = base_path('tests/storage/logs/report.log');
     \Log::useFiles($path);
     $exception = new \Illuminate\Database\Eloquent\ModelNotFoundException();
     $exception->setModel('Testing');
     $response = $this->handler->render($this->app['request'], $exception);
     $this->assertSame(404, $response->getStatusCode());
     $this->beforeApplicationDestroyed(function () use($path) {
         \File::delete($path);
     });
 }
示例#3
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)
 {
     if ($e instanceof ModelNotFoundException) {
         $e = new NotFoundHttpException($e->getMessage(), $e);
     }
     return parent::render($request, $e);
 }
示例#4
0
 public function render($request, Exception $e)
 {
     //we can target any error we like
     if ($e instanceof \Bootleg\Cms\CustomError) {
         //we can potentially return something different for ajax requests
         if ($request->ajax()) {
             return $this->renderExceptionWithWhoops($request, $e);
         } else {
             return $this->renderExceptionWithWhoops($request, $e);
         }
     }
     if ($this->isHttpException($e)) {
         $statusCode = $e->getStatusCode();
         switch ($statusCode) {
             //different handling for different error codes
             case '404':
                 return $this->renderHttpExceptionView($e);
                 break;
             default:
                 return $this->renderExceptionWithWhoops($request, $e);
                 break;
         }
     } else {
         return parent::render($request, $e);
     }
 }
 /**
  * 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)
 {
     if (strpos($request->url(), '/api/') === false) {
         return parent::render($request, $e);
     }
     $response = [];
     // If the app is in debug mode
     if (config('app.debug')) {
         // Add the exception class name, message and stack trace to response
         $response['exception'] = get_class($e);
         // Reflection might be better here
         $response['message'] = $e->getMessage();
         $response['file'] = $e->getFile();
         $response['line'] = $e->getLine();
     }
     // Default response of 400
     $status = 400;
     // If this exception is an instance of HttpException
     if ($this->isHttpException($e)) {
         // Grab the HTTP status code from the Exception
         $status = $e->getStatusCode();
         $response['status'] = $status;
         $response['message'] = self::$statusMessages[$status];
     }
     // Return a JSON response with the response array and status code
     return response()->json($response, $status)->header('Access-Control-Allow-Origin', env('ALLOWED_HOSTS', '*'))->header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT, DELETE')->header('Access-Control-Allow-Credentials', 'true')->header('Access-Control-Allow-Headers', 'Content-Type, X-Auth-Token, Origin, Authorization');
 }
示例#6
0
 public function render($request, Exception $e)
 {
     if (!env('APP_DEBUG')) {
         $this->csiService->registerCrash($e);
     }
     return parent::render($request, $e);
 }
 public function index()
 {
     $page = 'instituto-bulla';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $text = Texts::find(19);
     return view('website.bullaInstitute.index')->with(compact('page', 'pages', 'websiteSettings', 'text'));
 }
 public function index()
 {
     $page = 'conselhos-regionais';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $text = Texts::find(10);
     return view('website.regionalCouncils.index')->with(compact('page', 'pages', 'websiteSettings', 'text'));
 }
 public function index()
 {
     $page = 'seu-negocio-mais-lucrativo';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $text = Texts::find(18);
     return view('website.yourBusinessMoreLucrative.index')->with(compact('page', 'pages', 'websiteSettings', 'text'));
 }
 public function reliabilityAndQuality()
 {
     $page = 'medicamentos-genericos';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $texts = ReliabilityAndQuality::orderBy('sortorder', 'ASC')->get();
     return view('website.genericsMedications.reliabilityAndQuality')->with(compact('page', 'pages', 'websiteSettings', 'texts'));
 }
 public function index()
 {
     $page = 'universidade-teuto';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $text = Texts::find(4);
     return view('website.teutoUniversity.index')->with(compact('page', 'pages', 'websiteSettings', 'text'));
 }
 public function index()
 {
     $page = 'o-teuto';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $text = Texts::find(1);
     $movie = Texts::find(17);
     return view('website.theTeuto.index')->with(compact('page', 'pages', 'websiteSettings', 'text', 'movie'));
 }
 public function getResetWebsite($token = null)
 {
     $page = 'recuperar-senha';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $user = PasswordResets::where('token', '=', $token)->first();
     if (is_null($token)) {
         throw new NotFoundHttpException();
     }
     return view('website.profile.recoveryPassword')->with(compact('token', 'page', 'websiteSettings', 'pages', 'user'));
 }
 public function index()
 {
     $page = 'trabalhe-conosco';
     //WEBSITE SETTINGS
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $link = Texts::find(5);
     $mainText = Texts::find(16);
     $complementText = Texts::find(12);
     $vacancies = WorkWithUsVacancies::orderBy('sortorder', 'asc')->get();
     return view('website.workWithUs.index')->with(compact('page', 'websiteSettings', 'pages', 'link', 'mainText', 'complementText', 'vacancies'));
 }
 public function index()
 {
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $aboutMe = AboutMe::orderBy('sortorder', 'asc')->get();
     $experiences = Experience::orderBy('dateStart', 'desc')->get();
     $skills = Skills::orderBy('sortorder', 'asc')->get();
     $languages = Language::orderBy('sortorder', 'asc')->get();
     //foreach($languages as $language):
     //dd($language->writeName);
     //endforeach;
     return view('website.aboutme')->with(compact('websiteSettings', 'aboutMe', 'experiences', 'skills', 'languages'));
 }
 public function index(Request $request)
 {
     $page = 'eventos';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $type = 0;
     if (!empty($request->type) and $request->type == "internacionais") {
         $type = 1;
     }
     $events = Events::orderBy('date', 'desc')->where('type', '=', $type)->paginate(5);
     return view('website.events.index')->with(compact('page', 'pages', 'websiteSettings', 'request', 'events'));
 }
 public function post(Request $request)
 {
     //WEBSITE SETTINGS
     $websiteSettings = Handler::readFile("websiteSettings.json");
     $this->validate($request, ['name' => 'required|max:50', 'email' => 'required|email|max:50', 'phone' => 'required|max:20', 'message' => 'required']);
     array_set($request, "date", Carbon::now()->format('m/d/Y'));
     Mail::send('website.email.contact', ['request' => $request], function ($message) use($websiteSettings) {
         $message->from('*****@*****.**', 'Bruno Martins')->subject('Website Contact [brunomartins.com]')->to($websiteSettings['email']);
     });
     $message = "Contact sent successfully!";
     return redirect(route('index'))->with(compact('message'));
 }
 public function post(Request $request)
 {
     //WEBSITE SETTINGS
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $this->validate($request, ['name' => 'required|max:100', 'email' => 'required|email|max:40', 'state' => 'required', 'city' => 'required', 'message' => 'required']);
     array_set($request, "date", Carbon::now()->format('d/m/Y'));
     Mail::send('template.emailContact', ['request' => $request], function ($message) use($websiteSettings) {
         $message->from('*****@*****.**', 'Teuto/Pfizer')->subject('Contato pelo Site [hipodermeomega.com.br]')->to($websiteSettings['email']);
     });
     $success = "Contato enviado com sucesso!";
     return redirect(url('contato'))->with(compact('success'));
 }
 public function project(Request $request)
 {
     sleep(10);
     $project = Projects::where('projectsId', '=', $request->projectsId)->first();
     array_add($project, 'slug', Handler::createSlug($project->title, '-'));
     if (count($project->movie) > 0) {
         foreach ($project->movie as $movie) {
             array_add($movie, 'embed', ProjectsMovie::embedVideo($movie->url));
         }
     }
     $project->tags = str_replace(',', ', ', $project->tags);
     return view('website.project')->with(compact('project'));
 }
示例#20
0
 /**
  * Report exception to bugsnag.
  *
  * @author Casper Rasmussen <*****@*****.**>
  * @author Morten Rugaard <*****@*****.**>
  *
  * @param  \Exception $e
  * @return void
  */
 public function report(Exception $e)
 {
     try {
         if ($e instanceof NodesException && $e->getReport()) {
             app('nodes.bugsnag')->notifyException($e, $e->getMeta(), $e->getSeverity());
         } elseif (!$e instanceof NodesException && $this->shouldReport($e)) {
             app('nodes.bugsnag')->notifyException($e, null, 'error');
         }
     } catch (Exception $e) {
         // Do nothing
     }
     return parent::report($e);
 }
 public function imcCalculator(Request $request)
 {
     $page = 'material-de-apoio';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $imc = "";
     if ($request->method() == "POST") {
         $this->validate($request, ['height' => 'required|max:4', 'weight' => 'required|max:6'], ['height.required' => 'Informe a sua altura', 'height.max' => 'A altura não pode passar de :max caracteres', 'weight.required' => 'Informe o seu peso', 'weight.max' => 'O peso não pode passar de :max caracteres']);
         $weight = str_replace(',', '.', $request->weight);
         $height = str_replace(',', '.', $request->height);
         $imc = intval($weight / ($height * $height));
     }
     return view('website.supportMaterial.imcCalculator')->with(compact('page', 'pages', 'websiteSettings', 'imc'));
 }
 public function index()
 {
     $page = 'ganhadores-2014';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $advertising = Advertising::orderByRaw("RAND()")->get();
     foreach ($advertising as $ad) {
         array_add($ad, "image", Advertising::imageVideo($ad->url));
         array_set($ad, "url", Advertising::embedVideo($ad->url, 1));
     }
     $calls = Calls::orderByRaw("RAND()")->limit(2)->get();
     $winners = WinnersLastYear::orderBy('winnersLastYearId', 'ASC')->get();
     return view('website.winners2014')->with(compact('page', 'websiteSettings', 'pages', 'advertising', 'calls', 'winners'));
 }
 public function index()
 {
     $page = 'cadastre-se';
     //WEBSITE SETTINGS
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     //STATES
     $statesConsult = \App\Exceptions\Handler::readFile("states.json");
     $states = ['' => 'Estado'];
     foreach ($statesConsult as $state) {
         $states[$state['name']] = $state['name'];
     }
     $pages = Pages::where('slug', '=', $page)->first();
     return view('website.registration.index')->with(compact('page', 'websiteSettings', 'pages', 'states'));
 }
 public function index()
 {
     $page = 'o-concurso';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $advertising = Advertising::orderByRaw("RAND()")->get();
     foreach ($advertising as $ad) {
         array_add($ad, "image", Advertising::imageVideo($ad->url));
         array_set($ad, "url", Advertising::embedVideo($ad->url, 1));
     }
     $calls = Calls::orderByRaw("RAND()")->limit(2)->get();
     $theCompetition = TheCompetition::find(1);
     return view('website.theCompetition')->with(compact('page', 'websiteSettings', 'pages', 'advertising', 'calls', 'theCompetition'));
 }
 public function getResetWebsite($token = null)
 {
     $page = 'recuperar-senha';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $advertising = Advertising::orderByRaw("RAND()")->get();
     foreach ($advertising as $ad) {
         array_add($ad, "image", Advertising::imageVideo($ad->url));
         array_set($ad, "url", Advertising::embedVideo($ad->url, 1));
     }
     $calls = Calls::orderByRaw("RAND()")->limit(2)->get();
     if (is_null($token)) {
         throw new NotFoundHttpException();
     }
     return view('website.recoveryPassword')->with(compact('token', 'page', 'websiteSettings', 'pages', 'advertising', 'calls', 'awards'));
 }
 /**
  * Render an exception into an HTTP response.
  *
  * @param  Request   $request
  * @param  Exception $e
  * @return Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof HttpException) {
         if (!$e->getStatusCode() == 404) {
             return $this->renderHttpException($e);
         }
         if (($redirect = config('streams::404.redirect')) && $request->path() !== $redirect) {
             return redirect($redirect, 301);
         }
         return $this->renderHttpException($e);
     } elseif (!config('app.debug')) {
         return response()->view("streams::errors.500", ['message' => $e->getMessage()], 500);
     } else {
         return parent::render($request, $e);
     }
 }
示例#27
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)
 {
     if ($request->ajax() && !$request->pjax() || $request->wantsJson()) {
         return $this->sendResponseForApiException($e);
     }
     if (is_backend()) {
         if ($e instanceof ModelNotFoundException) {
             return $this->sendResponseForModelNotFound($e);
         }
         if ($e instanceof ValidationException) {
             return $this->sendResponseForValidationError($request, $e);
         }
         return $this->renderControllerException($e);
     }
     return parent::render($request, $e);
 }
 public function send(Request $request)
 {
     //WEBSITE SETTINGS
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $this->validate($request, ['name' => 'required|max:100', 'email' => 'required|email|max:40', 'message' => 'required', 'birthDate' => 'required_if:peopleType,Física|max:10', 'peopleType' => 'required', 'zipCode' => 'required', 'address' => 'required|max:120', 'state' => 'required', 'city' => 'required', 'cpf' => 'required_if:peopleType,Física|max:14', 'cnpj' => 'required_if:peopleType,Jurídica|max:18', 'youAre' => 'required_if:peopleType,Física', 'phone' => 'required_without:mobile', 'mobile' => 'required_without:phone'], ['name.required' => 'Informe seu nome', 'name.max' => 'O nome não pode passar de :max caracteres', 'email.required' => 'Informe seu e-mail', 'email.email' => 'Informe um e-mail válido', 'email.max' => 'O e-mail não pode passar de :max caracteres', 'birthDate.required' => 'Informe a data de nascimento', 'birthDate.max' => 'A data de nascimento não pode passar de :max caracteres', 'peopleType.required' => 'Informe o tipo de pessoa', 'cpf.required_if' => 'Informe o CPF', 'cpf.max' => 'O CPF não pode passar de :max caracteres', 'cnpj.required_if' => 'Informe o CNPJ', 'cnpj.max' => 'O CNPJ não pode passar de :max caracteres', 'youAre.required' => 'Informe qual das informações você se enquadra', 'phone.required_without' => 'Informe um número de telefone', 'mobile.required_without' => 'ou um número de celular', 'message.required' => 'Escreva uma mensagem']);
     array_set($request, "date", Carbon::now()->format('d/m/Y'));
     $emails = EmailsContact::find(1);
     Mail::send('website.contact.email', ['request' => $request], function ($message) use($emails) {
         $emailsSend = explode(',', $emails->emails);
         foreach ($emailsSend as $email) {
             $message->from('*****@*****.**', 'Teuto/Pfizer')->subject('Contato pelo Site [espacofarmaceutico.com.br]')->to($email);
         }
     });
     $success = "Contato enviado com sucesso!";
     return redirect(url('contato'))->with(compact('success'));
 }
 public function index(Request $request)
 {
     if ($request->getRequestUri() != '/') {
         $buttonClick = $request->getUri();
     }
     //WEBSITE SETTINGS
     $websiteSettings = Handler::readFile("websiteSettings.json");
     $projects = Projects::orderBy('sortorder', 'asc')->get();
     $lastProject = 0;
     foreach ($projects as $key => $project) {
         array_add($project, 'bootstrapColumn', Projects::bootstrapColumns($key));
         array_add($project, 'imagePrefixName', Projects::imagePrefixName($key));
         array_add($project, 'slug', Handler::createSlug($project->title, '-'));
         $lastProject = $project->sortorder;
     }
     return view('website.index')->with(compact('websiteSettings', 'projects', 'lastProject', 'buttonClick'));
 }
 public function read(Request $request)
 {
     $page = 'blog';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $date = $request->year . '-' . $request->month . '-' . $request->day;
     $blog = Blog::where('date', '=', $date)->where('slug', '=', $request->slug)->first();
     array_set($blog, "date", Carbon::createFromFormat('Y-m-d', $blog->date));
     //INCREMENT
     Blog::find($blog->blogId)->increment('read');
     //MORE BLOG
     $moreBlog = Blog::orderBy('date', 'desc')->where('blogId', '!=', $blog->blogId)->limit(2)->addSelect('title')->addSelect('date')->addSelect('slug')->get();
     foreach ($moreBlog as $item) {
         array_set($item, "date", Carbon::createFromFormat('Y-m-d', $item->date));
     }
     return view('website.blog.intern')->with(compact('page', 'pages', 'websiteSettings', 'blog', 'moreBlog'));
 }