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


PHP Request::segment方法代码示例

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


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

示例1: showNews

 /**
  * @return mixed
  */
 public function showNews()
 {
     $slug = Request::segment(2);
     $news_title = "Not active";
     $news_text = "Either this news item is not active, or it does not exist";
     $active = 1;
     $news_id = 0;
     $results = DB::table('news')->where('slug', '=', $slug)->get();
     foreach ($results as $result) {
         $active = $result->active;
         if ($active > 0 || Auth::check() && Auth::user()->hasRole('news')) {
             if (Session::get('lang') == null || Session::get('lang') == "en") {
                 $news_title = $result->title;
                 $news_text = $result->news_text;
                 $news_id = $result->id;
             } else {
                 $news_title = $result->title_fr;
                 $news_text = $result->news_text_fr;
                 $news_id = $result->id;
             }
             $news_image = $result->image;
             $news_date = $result->news_date;
         }
     }
     return View::make('public.news')->with('news_title', $news_title)->with('news_text', $news_text)->with('page_content', $news_text)->with('active', $active)->with('news_id', $news_id)->with('news_date', $news_date)->with('news_image', $news_image)->with('menu', $this->menu)->with('page_category_id', 0)->with('page_title', $news_title);
 }
开发者ID:tsawler,项目名称:catra,代码行数:29,代码来源:NewsController.php

示例2: build

 public function build($string)
 {
     $prefix = Request::segment(1) == 'admin' ? Request::segment(1) : null;
     $HTMLFormattedList = $this->formatList($string, $prefix, config('tabmenu.nowrap'));
     $this->countTags($HTMLFormattedList);
     return $HTMLFormattedList;
 }
开发者ID:dnabeast,项目名称:tabmenu,代码行数:7,代码来源:TabMenu.php

示例3: rules

 public function rules()
 {
     $id = Request::segment(3);
     $rules = ['name' => 'required', 'email' => 'required|unique:users,email,' . $id];
     if ($this->has('password')) {
         $rules['password'] = 'required|min:6|max:20';
     }
     return $rules;
 }
开发者ID:drongen,项目名称:admin,代码行数:9,代码来源:Update.php

示例4: setupDataTable

 /**
  * @param $dependents
  * @return array
  * @author Bertrand Kintanar
  */
 public function setupDataTable($dependents)
 {
     $table = [];
     $table['title'] = 'Assigned Dependents';
     $table['permission'] = str_replace('pim', 'profile', Request::segment(1)) . '.dependents';
     $table['headers'] = ['Full Name', 'Relationship', 'Birth Date'];
     $table['model'] = ['singular' => 'dependent', 'plural' => 'dependents', 'dashed' => 'dependents'];
     $table['items'] = $dependents;
     return $table;
 }
开发者ID:dobidobz,项目名称:HRis,代码行数:15,代码来源:DependentsController.php

示例5: change_status

 public function change_status()
 {
     $coupon_id = Request::segment(3);
     $status = Request::segment(4);
     $coupon = Coupon::find($coupon_id);
     $coupon['status'] = $status;
     $coupon->save();
     Session::flash('success', 'Coupon status updated successfully');
     return redirect('admin/coupon');
 }
开发者ID:amittier5,项目名称:miramix,代码行数:10,代码来源:CouponController.php

示例6: setupDataTable

 /**
  * @param $emergency_contacts
  * @return array
  * @author Bertrand Kintanar
  */
 public function setupDataTable($emergency_contacts)
 {
     $table = [];
     $table['title'] = 'In case of Emergency';
     $table['permission'] = str_replace('pim', 'profile', Request::segment(1)) . '.emergency-contacts';
     $table['headers'] = ['Full Name', 'Relationship', 'Home Telephone', 'Mobile'];
     $table['model'] = ['singular' => 'emergency_contact', 'plural' => 'emergency_contacts', 'dashed' => 'emergency-contacts'];
     $table['items'] = $emergency_contacts;
     return $table;
 }
开发者ID:dobidobz,项目名称:HRis,代码行数:15,代码来源:EmergencyContactsController.php

示例7: checkVisitor

 /**
  * Check visitor is revisit or unique new.
  */
 public function checkVisitor()
 {
     if (isset($_COOKIE["infogue-visitor"]) && $_COOKIE["infogue-visitor"] == Request::ip()) {
         if (Request::segment(1) == null) {
             $this->hit();
         }
     } else {
         $this->revisit();
     }
 }
开发者ID:anggadarkprince,项目名称:infogue,代码行数:13,代码来源:Visitor.php

示例8: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     if (Request::segment(1) != 'admin' && Request::segment(1) != 'api') {
         $router->bind('category', function ($slug) {
             $repository = app(CategoryInterface::class);
             return $repository->bySlug($slug);
         });
     }
 }
开发者ID:typicms,项目名称:categories,代码行数:17,代码来源:RouteServiceProvider.php

示例9: setupDataTable

 /**
  * @param $job_histories
  * @return array
  * @author Bertrand Kintanar
  */
 public function setupDataTable($job_histories)
 {
     $table = [];
     $table['title'] = 'Job History';
     $table['permission'] = str_replace('pim', 'profile', Request::segment(1)) . '.job-histories';
     $table['headers'] = ['Job Title', 'Department', 'Effective Date', 'Employment Status', 'Location', 'Comments'];
     $table['model'] = ['singular' => 'job_history', 'plural' => 'job_histories', 'dashed' => 'job-histories'];
     $table['items'] = $job_histories;
     return $table;
 }
开发者ID:dobidobz,项目名称:HRis,代码行数:15,代码来源:JobController.php

示例10: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $app = $this->app;
     /*
     |--------------------------------------------------------------------------
     | Set app locale in front office.
     |--------------------------------------------------------------------------
     */
     if (Request::segment(1) != 'admin') {
         $firstSegment = Request::segment(1);
         if (in_array($firstSegment, config('translatable.locales'))) {
             Config::set('app.locale', $firstSegment);
         }
         // Not very reliable, need to be refactored
         setlocale(LC_ALL, config('app.locale') . '_' . strtoupper(config('app.locale')) . '.utf8');
     }
     /*
     |--------------------------------------------------------------------------
     | Init list of modules.
     |--------------------------------------------------------------------------
     */
     Config::set('typicms.modules', []);
     /*
     |--------------------------------------------------------------------------
     | TypiCMS utilities.
     |--------------------------------------------------------------------------
     */
     $this->app->singleton('typicms', function (Application $app) {
         return new TypiCMS();
     });
     /*
     |--------------------------------------------------------------------------
     | TypiCMS upload service.
     |--------------------------------------------------------------------------
     */
     $this->app->singleton('upload.file', function (Application $app) {
         return new FileUpload();
     });
     /*
     |--------------------------------------------------------------------------
     | Sidebar view creator.
     |--------------------------------------------------------------------------
     */
     $app->view->creator('core::admin._sidebar', 'TypiCMS\\Modules\\Core\\Composers\\SidebarViewCreator');
     /*
     |--------------------------------------------------------------------------
     | View composers.
     |--------------------------------------------------------------------------|
     */
     $app->view->composers(['TypiCMS\\Modules\\Core\\Composers\\MasterViewComposer' => '*', 'TypiCMS\\Modules\\Core\\Composers\\LocaleComposer' => '*::public.*', 'TypiCMS\\Modules\\Core\\Composers\\LocalesComposer' => ['*::*._form']]);
     $this->registerCommands();
     $this->registerModuleRoutes();
     $this->registerCoreModules();
 }
开发者ID:vizo,项目名称:Core,代码行数:59,代码来源:ModuleProvider.php

示例11: context

 /**
  * Return the context type or match against the given type.
  * @return int|boolean
  */
 public static function context($is = null)
 {
     if (is_int($is)) {
         return static::context() === $is;
     }
     // Determine the type of request.
     switch (Request::segment(1)) {
         case config('app.cms_uri'):
             return static::CXT_CMS;
         case "api":
             return static::CXT_API;
         default:
             return static::CXT_SITE;
     }
 }
开发者ID:breachofmind,项目名称:birdmin,代码行数:19,代码来源:Application.php

示例12: memberDelete

 public function memberDelete(Request $request)
 {
     $id = (int) Request::segment(3);
     $action = Request::segment(4);
     if (Request::isMethod('get')) {
         $validator = Validator::make(Input::all(), User::$memberDeleteRules);
         if ($validator->passes()) {
             if (User::deleteMember($id)) {
                 return Redirect::to('users/members')->with('message', 'The following errors occurred')->withErrors('Delete successfully')->with('flag', 'success');
             } else {
                 return Redirect::to('users/member/' . $id . '/update')->with('message', 'The following errors occurred')->withErrors('Delete failed')->with('flag', 'danger');
             }
         } else {
             return Redirect::to('users/member/' . $id . '/update')->with('message', 'The following errors occurred')->withErrors($validator)->withInput()->with('flag', 'danger');
         }
     }
 }
开发者ID:jtoshmat,项目名称:laravel,代码行数:17,代码来源:UsersController.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $firstSegment = Request::segment(1);
     $locale = config('app.locale');
     if (in_array($firstSegment, config('translatable.locales'))) {
         $locale = $firstSegment;
     }
     // Throw a 404 if website in this language is offline
     if (!config('typicms.' . $locale . '.status')) {
         abort(404);
     }
     // Remove preview param if no admin user connected
     if (Input::get('preview') && !Auth::check()) {
         return Redirect::to(Request::path());
     }
     return $next($request);
 }
开发者ID:vizo,项目名称:Core,代码行数:24,代码来源:PublicLocale.php

示例14: register

 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('findLocale', function () {
         // If compatible ISO code if provided in URL
         if (in_array(Request::segment(1), $this->available)) {
             $this->setLocale(Request::segment(1));
             return App::getLocale();
         }
         // Search for compatible ISO code in HTTP header
         foreach ($this->getSupportedByClient() as $iso) {
             if (in_array($iso, $this->available)) {
                 $this->setLocale($iso);
                 break;
             }
         }
         return false;
     });
 }
开发者ID:simondubois,项目名称:budget,代码行数:23,代码来源:AppServiceProvider.php

示例15: showPage

 /**
  * Show a page
  *
  * @return mixed
  */
 public function showPage()
 {
     $slug = Request::segment(1);
     $page_title = "Not active";
     $page_content = "Either the page you requested is not active, or it does not exist.";
     $meta = "";
     $meta_keywords = "";
     $active = 1;
     $page_id = 0;
     $results = DB::table('pages')->where('slug', '=', $slug)->get();
     foreach ($results as $result) {
         $active = $result->active;
         if ($active > 0 || Auth::check() && Auth::user()->hasRole('pages')) {
             $page_title_field = Localize::localize('page_title');
             $page_content_field = Localize::localize('page_content');
             $page_title = $result->{$page_title_field};
             $page_content = $result->{$page_content_field};
             $page_id = $result->id;
             $meta_keywords = $result->meta_tags;
             $meta = $result->meta;
         }
     }
     return View::make('public.inside')->with('page_title', $page_title)->with('page_content', $page_content)->with('meta', $meta)->with('meta_tags', $meta_keywords)->with('active', $active)->with('page_id', $page_id)->with('menu', $this->menu);
 }
开发者ID:tsawler,项目名称:sdhs.ca,代码行数:29,代码来源:PageController.php


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