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


PHP Relation::morphMap方法代码示例

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


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

示例1: boot

 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     Relation::morphMap(['quran_recordings' => \Modules\Quran\Entities\QuranRecording::class]);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:12,代码来源:QuranServiceProvider.php

示例2: boot

 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot(Router $router)
 {
     $router->model('uuser', '\\Modules\\Users\\Entities\\User');
     $router->model('urole', '\\Bican\\Roles\\Models\\Role');
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     Relation::morphMap(['users' => \Modules\Users\Entities\User::class]);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:14,代码来源:UsersServiceProvider.php

示例3: boot

 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     Relation::morphMap(['paper_doc' => \Modules\Papers\Entities\PaperDoc::class, 'paper_semster_doc' => \Modules\Papers\Entities\PaperSemesterDoc::class]);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:12,代码来源:PapersServiceProvider.php

示例4: boot

 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     Relation::morphMap(['order_quran_excuses' => \Modules\Orders\Entities\OrderQuranExcuse::class]);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:12,代码来源:OrdersServiceProvider.php

示例5: boot

 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     Relation::morphMap([]);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:12,代码来源:ExamsServiceProvider.php

示例6: boot

 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     Relation::morphMap(['teachers' => \Modules\Teachers\Entities\Teacher::class]);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:12,代码来源:TeachersServiceProvider.php

示例7: register

 /**
  * Register the User module service provider.
  *
  * @return void
  */
 public function register()
 {
     // This service provider is a convenient place to register your modules
     // services in the IoC container. If you wish, you may make additional
     // methods or service providers to keep the code more focused and granular.
     App::register('App\\Modules\\User\\Providers\\RouteServiceProvider');
     App::register('App\\Modules\\User\\Providers\\RepositoryServiceProvider');
     Relation::morphMap([config('user_module.user_types.administrator') => App\Modules\User\Models\Administrator::class]);
     $this->registerNamespaces();
 }
开发者ID:damnyan,项目名称:laravel,代码行数:15,代码来源:UserServiceProvider.php

示例8: boot

 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     StudentGrade::creating(function ($grade) {
         $grade->semester_id = semester()->id;
     });
     Relation::morphMap(['students' => \Modules\Students\Entities\Student::class]);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:15,代码来源:StudentsServiceProvider.php

示例9: register

 /**
  * Register any package services.
  *
  * @return void
  */
 public function register()
 {
     $configPath = realpath(__DIR__ . '/../config/loggableModels.php');
     $this->publishes([$configPath => $this->getConfigPath()], 'config');
     $this->publishes([realpath(__DIR__ . '/../database/migrations/') => database_path('migrations')], 'migrations');
     // Define Custom Polymorphic Types
     Relation::morphMap([]);
     $this->mergeConfigFrom($configPath, 'loggableModels');
     $this->app->bind('loggable-models', function () {
         return new ModelLogHandler();
     });
 }
开发者ID:topix-hackademy,项目名称:loggable-models,代码行数:17,代码来源:ServiceProvider.php

示例10: addConversionsFromRelatedModel

 /**
  * Add the conversion that are defined on the related model of
  * the given media.
  *
  * @param \Spatie\MediaLibrary\Media $media
  */
 protected function addConversionsFromRelatedModel(Media $media)
 {
     $modelName = Arr::get(Relation::morphMap(), $media->model_type, $media->model_type);
     /*
      * To prevent an sql query create a new model instead
      * of the using the associated one
      */
     $model = new $modelName();
     if ($model instanceof HasMediaConversions) {
         $model->registerMediaConversions();
     }
     $this->items = $model->mediaConversions;
 }
开发者ID:henrikmartinsson,项目名称:laravel-medialibrary,代码行数:19,代码来源:ConversionCollection.php

示例11: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot(GateContract $gate, Router $router)
 {
     // set view paths
     $this->loadViewsFrom(resource_path('ohio/content/views'), 'ohio-content');
     // set backup view paths
     $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'ohio-content');
     // policies
     $this->registerPolicies($gate);
     // morphMap
     Relation::morphMap(['content/page' => Content\Page\Page::class]);
     // commands
     $this->commands(Content\Base\Commands\PublishCommand::class);
     Validator::extend('unique_route', \Ohio\Content\Base\Validators\RouteValidator::class . '@routeIsUnique');
 }
开发者ID:ohiocms,项目名称:content,代码行数:19,代码来源:OhioContentServiceProvider.php

示例12: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     // Validator function to check password hashes
     Validator::extend('hashed', function ($attribute, $value, $parameters) {
         // If we're already logged in
         if (Auth::check()) {
             $user = Auth::user();
         } else {
             // Otherwise, try to get the username from form input
             $user = User::where('name', Input::get('name'))->get();
             if (!$user->count()) {
                 return false;
             }
             $user = $user[0];
         }
         if (Hash::check($value, $user->password)) {
             return true;
         }
         return false;
     });
     // Define polymorphic relationship models
     Relation::morphMap(['question' => \App\Models\Question::class, 'document' => \App\Models\Document::class]);
 }
开发者ID:playatech,项目名称:weightlifter,代码行数:28,代码来源:AppServiceProvider.php

示例13: register

 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     \Illuminate\Database\Eloquent\Relations\Relation::morphMap([\App\Applicant::class, \App\Quota::class]);
 }
开发者ID:threening,项目名称:laraseda,代码行数:9,代码来源:AppServiceProvider.php

示例14: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     Relation::morphMap(['user' => \App\Models\User::class, 'admin' => \App\Models\Admin::class]);
 }
开发者ID:nutsdo,项目名称:nong-store,代码行数:9,代码来源:AppServiceProvider.php

示例15: getMorphClass

 /**
  * Get the class name for polymorphic relations.
  *
  * @return string
  */
 public function getMorphClass()
 {
     $morphMap = Relation::morphMap();
     $class = static::class;
     if (!empty($morphMap) && in_array($class, $morphMap)) {
         return array_search($class, $morphMap, true);
     }
     return $class;
 }
开发者ID:scrubmx,项目名称:framework,代码行数:14,代码来源:Model.php


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