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


PHP App::abort方法代码示例

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


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

示例1: showImage

 public function showImage($album_folder, $image_file)
 {
     $album = Album::with('images')->where('folder', $album_folder)->first();
     // $image = Image::with('album')->find($image_id);
     if (!$album) {
         App::abort(404, 'Album wasn\'t found.');
     }
     $count = $album->images->count();
     $success = false;
     for ($i = 0; $i < $count; $i++) {
         if ($album->images[$i]->image == $image_file) {
             $image = $album->images[$i];
             // Previous image
             if ($i == 0) {
                 $image->prev = $album->images[$count - 1];
             } else {
                 $image->prev = $album->images[$i - 1];
             }
             // Next image
             if ($i == $count - 1) {
                 $image->next = $album->images[0];
             } else {
                 $image->next = $album->images[$i + 1];
             }
             $success = true;
         }
     }
     if (!$success) {
         App::abort(404, 'Image wasn\'t found.');
     }
     return View::make('image', compact('image'));
 }
开发者ID:abhishekchaudhary996,项目名称:auto-generating-gallery,代码行数:32,代码来源:GalleryController.php

示例2: scopeWorkEnd

 /**
  * work end
  *
  **/
 public function scopeWorkEnd($query, $variable)
 {
     if (!is_array($variable)) {
         \App::abort(404);
     }
     return $query->where('hres_works.end', '>=', $variable[0])->where('hres_works.end', '<=', $variable[1]);
 }
开发者ID:ThunderID,项目名称:HRIS-API,代码行数:11,代码来源:HasWorkTrait.php

示例3: display

 /**
  * Method to display the view.
  *
  * @param	string	The template file to include
  * @since	1.5
  */
 function display($tpl = null)
 {
     // This name will be used to get the model
     $name = $this->getLayout();
     // Check that the name is valid - has an associated model.
     if (!in_array($name, array('confirm', 'complete'))) {
         $name = 'default';
     }
     if ('default' == $name) {
         $formname = 'Form';
     } else {
         $formname = ucfirst($this->_name) . ucfirst($name) . 'Form';
     }
     // Get the view data.
     $this->form = $this->get($formname);
     $this->state = $this->get('State');
     $this->params = $this->state->params;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         App::abort(500, implode('<br />', $errors));
         return false;
     }
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->prepareDocument();
     $password_rules = \Hubzero\Password\Rule::getRules();
     $this->password_rules = array();
     foreach ($password_rules as $rule) {
         if (!empty($rule['description'])) {
             $this->password_rules[] = $rule['description'];
         }
     }
     parent::display($tpl);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:40,代码来源:view.html.php

示例4: getParams

 /**
  * Parse the URL parameters and map each parameter (in order) to the given array of names
  *
  * @param		array varNames: Array of names to map the URL parameters to
  * @return		object: Object with properties named after var names mapped to URL parameters
  */
 protected function getParams($varNames)
 {
     $i = 0;
     // Strict processing doesn't allow extra or missing parameters in the URL
     $strictProcessing = false;
     $params = false;
     // check if there are more parameters than needed
     $extraParameter = Request::getVar('p' . count($varNames), '');
     if ($strictProcessing && !empty($extraParameter)) {
         // too many parameters in the URL
         //throw new \Exception('Too many parameters');
         App::abort(404, Lang::txt('Page Not Found'));
     }
     // Go through each var name and assign a sequential URL parameter's value to it
     foreach ($varNames as $varName) {
         $value = Request::getVar('p' . $i, '');
         if (!empty($value)) {
             $params->{$varName} = $value;
         } else {
             if ($strictProcessing) {
                 // missing parameter in the URL
                 //throw new \Exception('Too few parameters');
                 App::abort(404, Lang::txt('Page Not Found'));
             }
             break;
         }
         $i++;
     }
     return $params;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:36,代码来源:component.php

示例5: calculatePagingHeaders

 /**
  * Calculate the link meta-data for paging purposes, return an array with paging information
  *
  * @param integer $limit
  * @param integer $offset
  * @param integer $total_rows The total amount of objects
  *
  * @return array
  */
 public static function calculatePagingHeaders($limit, $offset, $total_rows)
 {
     $paging = array();
     // Check if limit and offset are integers
     if (!is_integer((int) $limit) || !is_integer((int) $offset)) {
         \App::abort(400, "Please make sure limit and offset are integers.");
     }
     // Calculate the paging parameters and pass them with the data object
     if ($offset + $limit < $total_rows) {
         $paging['next'] = array($limit + $offset, $limit);
         $last_page = round($total_rows / $limit, 1);
         $last_full_page = round($total_rows / $limit, 0);
         if ($last_page - $last_full_page > 0) {
             $paging['last'] = array($last_full_page * $limit, $limit);
         } else {
             $paging['last'] = array(($last_full_page - 1) * $limit, $limit);
         }
     }
     if ($offset > 0 && $total_rows > 0) {
         $previous = $offset - $limit;
         if ($previous < 0) {
             $previous = 0;
         }
         $paging['previous'] = array($previous, $limit);
     }
     return $paging;
 }
开发者ID:jalbertbowden,项目名称:core,代码行数:36,代码来源:Pager.php

示例6: onCheckMenuItem

 private function onCheckMenuItem($item)
 {
     if (isset($item['submenu'])) {
         foreach ($item['submenu'] as $key => $subItem) {
             $this->onCheckMenuItem($subItem);
         }
     } else {
         // FIXME:
         $isToCheck = false;
         if (isset($item['pattern'])) {
             $menuLink = \Config::get('builder::admin.uri') . $item['pattern'];
             $menuLink = ltrim($menuLink, '/');
             $pattern = '~^' . $menuLink . '$~';
             $isToCheck = preg_match($pattern, \Request::path());
         } else {
             $menuLink = \URL::to(\Config::get('builder::admin.uri') . $item['link']);
             $isToCheck = \Request::URL() == $menuLink;
         }
         if ($isToCheck) {
             $isAllowed = $item['check'];
             if (!$isAllowed()) {
                 \App::abort(404);
             }
         }
     }
 }
开发者ID:arturishe21,项目名称:buider,代码行数:26,代码来源:NavigationMenu.php

示例7: store

 /**
  * Store a payment notes
  * 
  * 1. Check transaction
  * 2. Check input
  * 3. Store Payment
  * 4. Check response
  * 5. Generate view
  * @param id
  * @return object view
  */
 public function store($id = null)
 {
     //1. Check transaction
     if (Input::has('transaction_id')) {
         $saleid = Input::get('transaction_id');
     } else {
         \App::abort(404);
     }
     $APISale = new APISale();
     $prev_sale = $APISale->getShow($saleid);
     if ($prev_sale['status'] != 'success') {
         $this->errors = $prev_sale['message'];
         return $this->generateRedirectRoute('shop.pay.create');
     }
     $sale = $prev_sale['data'];
     //2. Check input
     $inputPayment = Input::only('method', 'destination', 'account_name', 'account_number');
     $inputPayment['id'] = '';
     $inputPayment['amount'] = $sale['bills'];
     $inputPayment['ondate'] = date('Y-m-d H:i:s', strtotime(Input::get('ondate')));
     $sale['payment'] = $inputPayment;
     $sale['status'] = 'paid';
     //3. Store Payment
     $result = $APISale->postData($sale);
     //4. Check response
     if ($result['status'] != 'success') {
         $this->errors = $result['message'];
     } else {
         $mail = new APISendMail();
         $mail->paidorder($result['data'], $this->balininfo());
     }
     //5. Generate view
     $this->page_attributes->success = ['title' => 'Pesanan sudah divalidasi. ', 'action' => route('report.product.sale.detail', ['id' => $saleid]), 'actionTitle' => 'Klik disini untuk melihat Invoice barang.'];
     return $this->generateRedirectRoute('admin.dashboard', ['tab' => 'toko']);
 }
开发者ID:ThunderID,项目名称:balin-dashboard,代码行数:46,代码来源:PayController.php

示例8: readData

 public function readData($source_definition, $rest_parameters = array())
 {
     $uri = $source_definition['uri'];
     // Keep track of the prefix URI's
     $this->prefixes = array();
     // Check for caching
     if (Cache::has($uri)) {
         $data = Cache::get($uri);
     } else {
         // Fetch the data
         $data = @file_get_contents($uri);
         if (!empty($data)) {
             Cache::put($uri, $data, $source_definition['cache']);
         } else {
             $uri = $source_definition['uri'];
             \App::abort(500, "Cannot retrieve data from the XML file located on {$uri}.");
         }
     }
     $data_result = new Data();
     $data_result->data = $data;
     $data_result->semantic = $this->prefixes;
     $data_result->preferred_formats = $this->getPreferredFormats();
     if (!empty($source_definition['geo_formatted']) && $source_definition['geo_formatted']) {
         $data_result->geo_formatted = true;
         $data_result->preferred_formats = array('geojson', 'map', 'php');
     }
     return $data_result;
 }
开发者ID:tdt,项目名称:core,代码行数:28,代码来源:XMLController.php

示例9: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     // Publish config
     $configPath = __DIR__ . '/../../config/config.php';
     $this->publishes([$configPath => config_path('liebigCron.php')], 'config');
     // Build in Cron run route
     \Route::get('cron.php', function () {
         // Get security key from config
         $cronkeyConfig = \Config::get('liebigCron.cronKey');
         // If no security key is set in the config, this route is disabled
         if (empty($cronkeyConfig)) {
             \Log::error('Cron route call with no configured security key');
             \App::abort(404);
         }
         // Get security key from request
         $cronkeyRequest = \Input::get('key');
         // Create validator for security key
         $validator = \Validator::make(array('cronkey' => $cronkeyRequest), array('cronkey' => 'required|alpha_num'));
         if ($validator->passes()) {
             if ($cronkeyConfig === $cronkeyRequest) {
                 \Artisan::call('cron:run', array());
             } else {
                 // Configured security key is not equals the sent security key
                 \Log::error('Cron route call with wrong security key');
                 \App::abort(404);
             }
         } else {
             // Validation not passed
             \Log::error('Cron route call with missing or no alphanumeric security key');
             \App::abort(404);
         }
     });
 }
开发者ID:bernardowiredu,项目名称:iunlockgh,代码行数:38,代码来源:Laravel5ServiceProvider.php

示例10: image

 public function image()
 {
     if (!Auth::check()) {
         Session::flash('redirect', URL::current());
         return Redirect::route('login');
     }
     $relativePath = Input::get('path');
     $filePath = Input::get('file');
     $path = Path::fromRelative($relativePath);
     if (!$path->exists()) {
         App::abort(404, 'Archive not found');
     }
     $archive = Archive\Factory::open($path);
     $imageStream = $archive->getEntryStream($filePath);
     $imageData = stream_get_contents($imageStream);
     $response = Response::make($imageData);
     $ext = pathinfo($filePath, PATHINFO_EXTENSION);
     switch ($ext) {
         case 'jpg':
         case 'jpeg':
             $response->header('Content-Type', 'image/jpeg');
             break;
         case 'png':
             $response->header('Content-Type', 'image/png');
             break;
     }
     $response->header('Last-Modified', gmdate('D, d M Y H:i:s', $path->getMTime()) . ' GMT');
     $response->header('Expires', gmdate('D, d M Y H:i:s', strtotime('+1 year')) . ' GMT');
     $response->header('Cache-Control', 'public');
     return $response;
 }
开发者ID:qqueue,项目名称:MangaIndex,代码行数:31,代码来源:ReaderController.php

示例11: postEditRoles

 public function postEditRoles()
 {
     /* code is a bit messy, lots of repetition, try to refactor later */
     $user = User::find(Input::get('id'));
     if (!$user) {
         App::abort(404);
     }
     if (Input::has('emp_admin') && $user->hasRole('Employee MS Administrator') === false) {
         $user->roles()->attach(2);
     } else {
         if ($user->hasRole('Employee MS Administrator')) {
             $user->roles()->detach(2);
         }
     }
     if (Input::has('prop_admin') && $user->hasRole('Property MS Administrator') === false) {
         $user->roles()->attach(3);
     } else {
         if ($user->hasRole('Property MS Administrator')) {
             $user->roles()->detach(3);
         }
     }
     if (Input::has('perf_admin') && $user->hasRole('Performance MS Administrator') === false) {
         $user->roles()->attach(4);
     } else {
         if ($user->hasRole('Performance MS Administrator')) {
             $user->roles()->detach(4);
         }
     }
     return Redirect::route('profile', $user->id)->with('alert', 'success|This user\'s roles have been updated successfully.');
 }
开发者ID:codeblues1516,项目名称:godaddy,代码行数:30,代码来源:AdminController.php

示例12: show

 public function show($id)
 {
     // init
     $event = Events::with(array('city', 'eventcategory', 'user'))->where('id', '=', $id)->orderBy('id', 'desc')->first();
     $data = array('menu' => $this->_menu, 'title' => 'Event - ' . $event->name, 'description' => '', 'breadcrumb' => array('Event' => route('admin.event'), $event->name => route('admin.event.show', $event->id)));
     if ($event == null) {
         return App::abort('404');
     }
     $data['event'] = $event;
     $social_action = SocialActionEvent::with(array('user', 'socialAction'))->where('event_id', '=', $event['id'])->orderBy('id', 'desc')->get();
     // Get category
     // $data['social_actions'] = $social_action;
     $sos = array();
     if (count($social_action) > 0) {
         foreach ($social_action as $val) {
             # code...
             $sos[] = $val['social_action'];
         }
         $data['social_actions'] = $sos;
         // Get Photos that related with this
         $data['photos'] = Photo::where('type_name', '=', 'social_actions')->where('type_id', '=', $social_action[0]->id)->orderBy('id', 'desc')->get();
     } else {
         $data['social_actions'] = array();
         $data['photos'] = array();
     }
     return View::make('admin.pages.event.show')->with($data);
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:27,代码来源:AdminEventController.php

示例13: 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('sysconfig.account.account_password_reset')->with('token', $token);
 }
开发者ID:252114997,项目名称:ourshow,代码行数:13,代码来源:RemindersController.php

示例14: getMod

 public function getMod($slug)
 {
     $table_javascript = route('tdf_name', ['modmodpacks', '0', $slug]);
     $mod = Mod::where('slug', '=', $slug)->first();
     if (!$mod) {
         $redirect = new URLRedirect();
         $do_redirect = $redirect->getRedirect(Request::path());
         if ($do_redirect) {
             return Redirect::to($do_redirect->target, 301);
         }
         App::abort(404);
     }
     $can_edit = false;
     if (Auth::check()) {
         $maintainer = $mod->maintainers()->where('user_id', Auth::id())->first();
         if ($maintainer) {
             $can_edit = true;
         }
     }
     $authors = $mod->authors;
     $spotlights = $mod->youtubeVideos()->where('category_id', 2)->get();
     $tutorials = $mod->youtubeVideos()->where('category_id', 3)->get();
     $raw_links = ['website' => $mod->website, 'download_link' => $mod->download_link, 'donate_link' => $mod->donate_link, 'wiki_link' => $mod->wiki_link];
     $links = [];
     foreach ($raw_links as $index => $link) {
         if ($link != '') {
             $links["{$index}"] = $link;
         }
     }
     $markdown_html = Parsedown::instance()->setBreaksEnabled(true)->text(strip_tags($mod->description));
     $mod_description = str_replace('<table>', '<table class="table table-striped table-bordered">', $markdown_html);
     $title = $mod->name . ' - Mod - ' . $this->site_name;
     $meta_description = $mod->deck;
     return View::make('mods.detail', ['table_javascript' => $table_javascript, 'mod' => $mod, 'mod_description' => $mod_description, 'links' => $links, 'authors' => $authors, 'title' => $title, 'meta_description' => $meta_description, 'sticky_tabs' => true, 'spotlights' => $spotlights, 'tutorials' => $tutorials, 'can_edit' => $can_edit]);
 }
开发者ID:helkarakse,项目名称:modpackindex,代码行数:35,代码来源:ModController.php

示例15: handleRequest

 public function handleRequest()
 {
     // TODO create "page not found" page
     $uri = Request::path();
     // Default version of the documentation
     $page = 'introduction';
     $versions = array("4.0", "4.1", "4.2", "4.3", "4.6", "5.0", "5.6", "5.12");
     $version = end($versions);
     // If not the root, then split the uri to find the content
     $segment1 = Request::segment(1);
     $segment2 = Request::segment(2);
     if (!empty($segment1)) {
         $version = $segment1;
         if (!empty($segment2)) {
             $page = $segment2;
         }
     }
     // Show the correct markdown contents
     $page = __DIR__ . '/docs/' . $version . '/' . $page . '.md';
     if (file_exists($page)) {
         $contents = file_get_contents($page);
         $sidebar = file_get_contents(__DIR__ . '/docs/' . $version . '/sidebar.md');
         // Transform documents
         $contents_html = Markdown::defaultTransform($contents);
         $sidebar_html = Markdown::defaultTransform($sidebar);
         // Replace url variable
         $sidebar_html = preg_replace('/{url}/mi', URL::to($version), $sidebar_html);
         return View::make('layouts.master')->with('version', $version)->with('versions', $versions)->with('sidebar', $sidebar_html)->with('content', $contents_html);
     } else {
         \App::abort(400, "The page you were looking for could not be found.");
     }
 }
开发者ID:rossjones,项目名称:docs,代码行数:32,代码来源:HomeController.php


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