当前位置: 首页>>代码示例>>PHP>>正文


PHP App::abort方法代码示例

本文整理汇总了PHP中App\Http\Controllers\App::abort方法的典型用法代码示例。如果您正苦于以下问题:PHP App::abort方法的具体用法?PHP App::abort怎么用?PHP App::abort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Http\Controllers\App的用法示例。


在下文中一共展示了App::abort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handler

 public static function handler()
 {
     $data = array('success' => false, 'title' => trans('t.contactErrorTitle'), 'message' => trans('t.contactErrorMessage'));
     $requestAllowed = true;
     if (self::$requestType == 'ajax') {
         $requestAllowed = \Request::ajax() && \Request::get('getIgnore_isAjax');
     }
     if ($requestAllowed) {
         $validator = \Validator::make(\Request::all(), self::$rules);
         if ($validator->fails()) {
             $messages = $validator->getMessageBag()->toArray();
             $finalMessages = array();
             foreach ($messages as $field => $fieldMessages) {
                 foreach ($fieldMessages as $fieldMessage) {
                     $finalMessages[] = $fieldMessage;
                 }
             }
             $message = implode("\n", $finalMessages);
             $data['message'] = $message;
             return self::returnData($data);
         } else {
             try {
                 Mailer::sendMessage(\Request::all());
                 $data['success'] = true;
                 $data['title'] = trans('t.contactSuccessTitle');
                 $data['message'] = trans('t.contactSuccessMessage');
             } catch (\Exception $e) {
                 Dbar::error("Error while sending message: " . $e->getMessage());
             }
         }
         return self::returnData($data);
     }
     \App::abort(404);
 }
开发者ID:gtcrais,项目名称:gtcms,代码行数:34,代码来源:ContactController.php

示例2: cropPhotoEntidade

 /**
  * [updatePhoto description]
  * @param  Integer Id do usuário
  * @return ??
  */
 public function cropPhotoEntidade($entidade, CropPhotoRequest $request)
 {
     if (!$entidade) {
         App::abort(500, 'Erro durante o processamento do crop');
     }
     $file = Input::file('image_file_upload');
     if ($file && $file->isValid()) {
         $widthCrop = $request->input('w');
         $heightCrop = $request->input('h');
         $xSuperior = $request->input('x');
         $ySuperior = $request->input('y');
         $destinationPath = public_path() . '/uploads/';
         $extension = Input::file('image_file_upload')->getClientOriginalExtension();
         // Pega o formato da imagem
         $fileName = self::formatFileNameWithUserAndTimestamps($file->getClientOriginalName()) . '.' . $extension;
         $file = \Image::make($file->getRealPath())->crop($widthCrop, $heightCrop, $xSuperior, $ySuperior);
         $upload_success = $file->save($destinationPath . $fileName);
         //Salvando imagem no avatar do usuario;
         if ($upload_success) {
             /* Settando tipo da foto atual para null, checando se existe antes */
             if ($entidade->avatar) {
                 $currentAvatar = $entidade->avatar;
                 $currentAvatar->tipo = null;
                 $currentAvatar->save();
             }
             $foto = new Foto(['path' => $fileName, 'tipo' => 'avatar']);
             $entidade->fotos()->save($foto);
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:centaurustech,项目名称:vivala,代码行数:38,代码来源:VivalaBaseController.php

示例3: form

 function form($id = null)
 {
     /////////////////////////////
     // Load Data if applicable //
     /////////////////////////////
     if ($id) {
         $query['id'] = $id;
         $api_response = json_decode($this->api->get($this->api_url . '/travel_agents?' . http_build_query(array_merge($query, ['access_token' => Session::get('access_token')])))->getBody());
         if ($api_response->status != 'success') {
             return App::abort(404);
         }
         $data = $this->reformat_images($api_response->data->data)[0];
         foreach ($data->addresses as $address) {
             $address->status = 'data';
         }
         unset($data->addresses);
         $data->addresses = [$address];
     }
     /////////////////
     // Create Form //
     /////////////////
     $this->layout->page_template = view($this->version . '.vendors.template');
     $this->layout->page_template->page = view($this->version . '.vendors.travel_agents.form')->with('id', $id);
     $this->layout->page_template->page->data = $data;
     return $this->layout;
 }
开发者ID:erickmo,项目名称:CapcusCmsV3,代码行数:26,代码来源:TravelAgentController.php

示例4: MessageBag

 function __construct()
 {
     $this->errors = new MessageBag();
     $this->page_attributes = new \Stdclass();
     $api_url = '/oauth/client/access_token';
     $api_data = ['grant_type' => 'client_credentials', 'client_id' => env('CLIENT_ID'), 'client_secret' => env('CLIENT_SECRET')];
     $api = new API();
     $result = json_decode($api->post($api_url, $api_data), true);
     // Get success API token
     if ($result['status'] == "success") {
         Session::set('API_token_public', $result['data']['token']['token']);
         Session::set('API_token', $result['data']['token']['token']);
     } else {
         \App::abort(503);
     }
     //generate balin information
     $APIConfig = new APIConfig();
     $config = $APIConfig->getIndex(['search' => ['default' => 'true'], 'sort' => ['name' => 'asc']]);
     $balin = $config['data'];
     unset($balin['info']);
     foreach ($config['data']['info'] as $key => $value) {
         $balin['info'][$value['type']] = $value;
     }
     $this->balin = $balin;
     //nanti kalu butuh template lebih dari satu, switch case aja disini.
     $this->layout = view('web_v2.page_templates.layout');
 }
开发者ID:ThunderID,项目名称:BALIN-2.0,代码行数:27,代码来源:BaseController.php

示例5: getReset

 /**
  * Display the password reset view for the given token.
  *
  * @param  string  $token
  * @return Response
  */
 public function getReset($token = null)
 {
     if (is_null($token)) {
         App::abort(404);
     }
     return View::make('password.reset')->with('token', $token);
 }
开发者ID:tommarshallandrews,项目名称:gloseventhire,代码行数:13,代码来源:RemindersController.php

示例6: getPoster

 public function getPoster($id)
 {
     $poster = Poster::find($id);
     if (!$poster) {
         App::abort(404);
     }
     return view('posters/view', array('poster' => $poster));
 }
开发者ID:antoha805,项目名称:PostersBase,代码行数:8,代码来源:PosterController.php

示例7: __construct

 public function __construct(Request $request)
 {
     $this->user = \Auth::user();
     if (!$this->user->userCan('adminka-access')) {
         \App::abort(403, 'Access denied');
     }
     $this->request = $request;
 }
开发者ID:serovvitaly,项目名称:kotik,代码行数:8,代码来源:AdminController.php

示例8: showProfile

 /**
  * [showProfile description]
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public function showProfile($id)
 {
     $user = User::find($id);
     if (is_null($user)) {
         App::abort(404);
     }
     return View::make('pages.user.profile', array('user' => $user, 'briefingRows' => trans('profile.briefingRows')));
 }
开发者ID:programadorjff,项目名称:ioltest,代码行数:13,代码来源:UserController.php

示例9: listarPorEstado

 public function listarPorEstado($estadoId)
 {
     $estado = Estado::find($estadoId);
     if (is_null($estado)) {
         App::abort(404);
     }
     $municipios = Municipio::orderBy('nombre')->where('estado_id', '=', $estadoId)->get();
     return $municipios;
 }
开发者ID:hectorgarcia83,项目名称:plataforma_eliana,代码行数:9,代码来源:MunicipioController.php

示例10: edit

 public function edit($username)
 {
     $user = User::where('username', $username)->get();
     $s_config = Config::get('social.networks');
     if ($user->count()) {
         return view('profile.edit')->with(['user' => $user->first(), 's_config' => $s_config]);
     }
     return App::abort(404);
 }
开发者ID:abjelosevic88,项目名称:dipl,代码行数:9,代码来源:ProfileController.php

示例11: eliminar

 public function eliminar($id)
 {
     $participante = Participante::find($id);
     if (is_null($participante)) {
         App::abort(404);
     }
     $participante->delete();
     return response()->json(['success' => true, 'msg' => 'Usuario ' . $participante->nombres . ' ' . $participante->apellidos . ' eliminado.', 'id' => $participante->id]);
 }
开发者ID:byrogr,项目名称:palcokia,代码行数:9,代码来源:CompetitorController.php

示例12: user

 public function user($username)
 {
     $user = User::where('username', '=', $username);
     if ($user->count()) {
         $user = $user->first();
         return view('account.profile')->withUser($user);
     }
     return \App::abort(404);
 }
开发者ID:TraianAlex,项目名称:laravel2,代码行数:9,代码来源:ProfileController.php

示例13: findPlayer

 /**
  * @param $platform
  * @param $gamertag
  * @return \Destiny\Player
  */
 protected function findPlayer($platform, $gamertag)
 {
     $players = destiny()->player($gamertag);
     $player = $players->get($platform);
     if (!$player instanceof Player) {
         \App::abort(404, "The player '{$gamertag}' on '{$platform}' could not be found.");
     }
     return $player;
 }
开发者ID:TrackerNetwork,项目名称:DestinyStatus,代码行数:14,代码来源:AccountController.php

示例14: getEmbedded

 public function getEmbedded($slug = null)
 {
     $doc = Doc::findDocBySlug($slug);
     if (is_null($doc)) {
         App::abort('404');
     }
     $view = View::make('doc.reader.embed', compact('doc'));
     return $view;
 }
开发者ID:johnfelipe,项目名称:madison,代码行数:9,代码来源:DocController.php

示例15: destroy

 /**
  * @GET("/nottifications/{id}/delete/", as="nottifications.destroy")
  */
 public function destroy($id)
 {
     $model = Nottifications::where('id', $id)->first();
     if ($model->user->id != Auth::user()->id) {
         App::abort(404);
     } else {
         $model->delete();
     }
 }
开发者ID:lyovkin,项目名称:v2board,代码行数:12,代码来源:NottifactionsController.php


注:本文中的App\Http\Controllers\App::abort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。