當前位置: 首頁>>代碼示例>>PHP>>正文


PHP RouteServiceProvider::boot方法代碼示例

本文整理匯總了PHP中Illuminate\Foundation\Support\Providers\RouteServiceProvider::boot方法的典型用法代碼示例。如果您正苦於以下問題:PHP RouteServiceProvider::boot方法的具體用法?PHP RouteServiceProvider::boot怎麽用?PHP RouteServiceProvider::boot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Foundation\Support\Providers\RouteServiceProvider的用法示例。


在下文中一共展示了RouteServiceProvider::boot方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     $router->pattern('user', '[0-9]+');
     $router->pattern('id', '[0-9]+');
     parent::boot($router);
 }
開發者ID:phumaster,項目名稱:uploadImage,代碼行數:13,代碼來源:RouteServiceProvider.php

示例2: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     $router->model('users', 'App\\User', function () {
         throw new UserNotFoundException();
     });
     $router->model('regions', 'App\\Region', function () {
         throw new RegionNotFoundException();
     });
     $router->model('provision_types', 'App\\ProvisionType', function () {
         throw new ProvisionTypeNotFoundException();
     });
     $router->model('funds', 'App\\Fund', function () {
         throw new FundNotFoundException();
     });
     $router->model('providers', 'App\\Provider', function () {
         throw new ProviderNotFoundException();
     });
     $router->model('organisation_types', 'App\\OrganisationType', function () {
         throw new OrganisationTypeNotFoundException();
     });
     $router->model('locations', 'App\\Location', function () {
         throw new LocationNotFoundException();
     });
     $router->model('countries', 'App\\Country', function () {
         throw new CountryNotFoundException();
     });
 }
開發者ID:wyrover,項目名稱:refund-api,代碼行數:36,代碼來源:RouteServiceProvider.php

示例3: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->bind('client', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return Client::findOrFail($id);
     });
     $router->bind('bank', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return BankDetail::findOrFail($id);
     });
     $router->bind('address', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return Address::findOrFail($id);
     });
     $router->bind('property', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return Property::findOrFail($id);
     });
     $router->bind('agreement', function ($value, $route) {
         $hashids = new Hashids('MySecretSalt*(&^%$eo&*^%&r', 20);
         $id = $hashids->decode($value)[0];
         return RentalAgreement::findOrFail($id);
     });
     //
 }
開發者ID:arianpour,項目名稱:AgentProV0.6,代碼行數:36,代碼來源:RouteServiceProvider.php

示例4: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot(Router $router)
 {
     $this->loadViewsFrom(__DIR__ . '/views', 'jiracal');
     $this->publishes([__DIR__ . '/views' => resource_path('views/vendor/jiracal')], 'views');
     $this->publishes([__DIR__ . '/config/jiracal.php' => config_path('jiracal.php')], 'config');
     parent::boot($router);
 }
開發者ID:josevh,項目名稱:jiracal,代碼行數:12,代碼來源:JiraCalServiceProvider.php

示例5: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     $router->model('posts', 'App\\Post');
     $router->model('tags', 'App\\Tag');
 }
開發者ID:BinaryEye,項目名稱:TheOneWhoCantBeNamed,代碼行數:13,代碼來源:RouteServiceProvider.php

示例6: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     \Route::bind('category', function ($value) {
         return \App\Model\Option::where('id', $value)->first();
     });
 }
開發者ID:kpaxer,項目名稱:shcms,代碼行數:13,代碼來源:RouteServiceProvider.php

示例7: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->bind('user', function ($value) {
         //return User::where('name', $value)->first();
     });
 }
開發者ID:Soul0806,項目名稱:MyWeb,代碼行數:13,代碼來源:RouteServiceProvider.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);
     $router->bind('username', function ($username) {
         return User::whereName($username)->firstOrFail();
     });
 }
開發者ID:filipve,項目名稱:Build-An-Activity-Feed-in-Laravel,代碼行數:13,代碼來源:RouteServiceProvider.php

示例9: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     // DATABIDING, permet d'utiliser les objets à tous moment grâce au DATABIDING ex : user
     $router->model('users', 'App\\Users', function () {
         App::abort(500);
     });
     $router->model('roles_users', 'App\\Roles_users', function () {
         App::abort(500);
     });
     $router->model('langues', 'App\\Langues', function () {
         App::abort(500);
     });
     $router->model('pays', 'App\\Pays', function () {
         App::abort(500);
     });
     $router->model('ville', 'App\\Villes', function () {
         App::abort(500);
     });
     $router->model('actu', 'App\\Actu', function () {
         App::abort(500);
     });
     $router->model('notification', 'App\\NotificationHistory', function () {
         App::abort(500);
     });
 }
開發者ID:bilel99,項目名稱:social_network,代碼行數:33,代碼來源:RouteServiceProvider.php

示例10: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->bind('attendees', function ($id) {
         return \App\Attendee::where('id', $id)->firstOrFail();
     });
     parent::boot($router);
 }
開發者ID:sgualini,項目名稱:verifica_partecipanti_corso,代碼行數:13,代碼來源:RouteServiceProvider.php

示例11: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     // For route model binding
     //Route::model()
     //This is ok for small projects
     //for larger projects
     //we can pass a closure for a detailed result
     //
     //For ex
     //
     //$router->bind('articles',function($id)
     //{
     //  return reddev\Article::published()->find($id);
     //});
     //
     //first parameter <articles> is the wildcard being
     //used in the routes, can be checked from route:list command
     //
     //$id is the ID being used
     $router->model('articles', 'reddev\\Article');
     $router->model('users', 'reddev\\User');
     $router->model('pages', 'reddev\\Page');
 }
開發者ID:red812,項目名稱:personalblog,代碼行數:31,代碼來源:RouteServiceProvider.php

示例12: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     /**
      * Binding the model
      */
     // $router->model('articles', 'App\Article');
     /**
      * Optional custom bind
      */
     $router->bind('articles', function ($id) {
         /**
          * Show only the published articles
          */
         return \App\Article::published()->findOrFail($id);
     });
     // $router->model('tags', 'App\Tag');
     $router->bind('tags', function ($name) {
         /**
          * Show only the related same tag by name
          */
         return \App\Tag::where('name', $name)->firstOrFail();
     });
 }
開發者ID:rudbast,項目名稱:laravel-tutorial,代碼行數:31,代碼來源:RouteServiceProvider.php

示例13: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     $router->bind('articles', function ($id) {
         $article = Article::findOrFail($id);
         // If the owner return all articles else return only published.
         if (Auth::user() && $article->user_id === Auth::user()->id) {
             $articles = Article::findOrFail($id);
         } else {
             $articles = Article::published()->findOrFail($id);
         }
         return $articles;
     });
     $router->bind('questions', function ($id) {
         return Question::findOrFail($id);
     });
     $router->bind('answers', function ($id) {
         return Answer::findOrFail($id);
     });
     $router->bind('tags', function ($name) {
         return Tag::where('name', $name)->firstOrFail();
     });
     $router->bind('users', function ($id) {
         return User::findOrFail($id);
     });
 }
開發者ID:nilstr,項目名稱:stackoverflow-clone,代碼行數:33,代碼來源:RouteServiceProvider.php

示例14: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->bind('posts', function ($value) {
         return Post::findBySlugOrIdOrFail($value);
     });
     parent::boot($router);
 }
開發者ID:spitzgoby,項目名稱:spitzgoby,代碼行數:13,代碼來源:RouteServiceProvider.php

示例15: boot

 /**
  * {@inheritdoc}
  */
 public function boot(Router $router = null)
 {
     $this->publishes([dirname(__DIR__) . '/config/routes.php' => $this->app->make('path.config') . '/routes.php'], 'config');
     $this->binders = $this->app->call([$this, 'makeBinders']);
     $this->app->call([$this, 'bind']);
     parent::boot($router);
 }
開發者ID:guiwoda,項目名稱:route-binder,代碼行數:10,代碼來源:RouteBinderServiceProvider.php


注:本文中的Illuminate\Foundation\Support\Providers\RouteServiceProvider::boot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。