本文整理汇总了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);
}
示例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;
}
}
}
示例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;
}
示例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');
}
示例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);
}
示例6: getPoster
public function getPoster($id)
{
$poster = Poster::find($id);
if (!$poster) {
App::abort(404);
}
return view('posters/view', array('poster' => $poster));
}
示例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;
}
示例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')));
}
示例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;
}
示例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);
}
示例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]);
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
}