Esempio n. 1
2
 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     Relation::morphMap(['quran_recordings' => \Modules\Quran\Entities\QuranRecording::class]);
 }
Esempio n. 2
1
 /**
  * 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]);
 }
Esempio n. 3
0
 /**
  * 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]);
 }
Esempio n. 4
0
 /**
  * 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]);
 }
Esempio n. 5
0
 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     Relation::morphMap([]);
 }
 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     Relation::morphMap(['teachers' => \Modules\Teachers\Entities\Teacher::class]);
 }
Esempio n. 7
0
 /**
  * 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();
 }
 /**
  * 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]);
 }
 /**
  * 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();
     });
 }
 /**
  * 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;
 }
 /**
  * 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');
 }
 /**
  * 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]);
 }
Esempio n. 13
0
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     \Illuminate\Database\Eloquent\Relations\Relation::morphMap([\App\Applicant::class, \App\Quota::class]);
 }
Esempio n. 14
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     Relation::morphMap(['user' => \App\Models\User::class, 'admin' => \App\Models\Admin::class]);
 }
Esempio n. 15
0
 /**
  * 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;
 }
Esempio n. 16
0
 public function testCorrectMorphClassIsReturned()
 {
     Relation::morphMap(['alias' => 'AnotherModel']);
     $model = new EloquentModelStub();
     try {
         $this->assertEquals('EloquentModelStub', $model->getMorphClass());
     } finally {
         Relation::morphMap([], false);
     }
 }
Esempio n. 17
0
 /**
  * Set the morph map for polymorphic relations.
  *
  * @return $this
  */
 protected function morphMap()
 {
     Relation::morphMap([\App\Accounts\Role::class, \App\Accounts\User::class, \App\Attachments\Attachment::class, \App\Documents\Document::class, \App\Zinc\Zinc::class]);
     return $this;
 }
Esempio n. 18
0
 public static function boot()
 {
     parent::boot();
     Relation::morphMap(static::$geometriedTypes);
 }
 protected function registerMorphMap()
 {
     if ($this->morphModels) {
         $morphMap = [];
         foreach ($this->morphModels as $morphType => $morphModel) {
             $morphMap[$morphType] = $morphModel;
         }
         Relation::morphMap($morphMap);
     }
 }
Esempio n. 20
0
 /**
  * Stores an actual instance of an adjustable model to the database.
  *
  * @param  Model $model
  * @param  array $attributes
  * @return Adjustable
  */
 protected function storeAdjustableModel(Model $model, array $attributes = []) : Adjustable
 {
     Relation::morphMap([$model->getTable() => get_class($model)]);
     return $model->create(array_merge(['name' => 'Mango', 'price' => 10], $attributes));
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     // Map string in *_type to model classes
     Relation::morphMap(['design' => \App\Design::class, 'designer' => \App\Designer::class, 'place' => \App\Place::class, 'story' => \App\Story::class, 'country' => \App\Country::class, 'city' => \App\City::class, 'tag' => \App\Tag::class, 'image' => \App\Image::class]);
 }
 /**
  * Get the model's type.
  *
  * @return string
  */
 protected function getModelType()
 {
     $class = get_class($this->model);
     $morphedClass = array_search($class, Relation::morphMap());
     return $morphedClass ? $morphedClass : $class;
 }
 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     Relation::morphMap(['post' => 'App\\Storage\\Post\\Post', 'comment' => 'App\\Storage\\Comment\\Comment', 'like' => 'App\\Storage\\Likeable\\Likeable', 'user' => 'App\\Storage\\User\\User']);
     $this->app->bind('App\\Storage\\EmailConfirmation\\EmailConfirmationRepository', 'App\\Storage\\EmailConfirmation\\DatabaseEmailConfirmationRepository');
     $this->app->bind('App\\Storage\\PasswordRecoveryConfirmation\\PasswordRecoveryConfirmationRepository', 'App\\Storage\\PasswordRecoveryConfirmation\\DatabasePasswordRecoveryConfirmationRepository');
 }
 /**
  * Register Bouncer's models in the relation morph map.
  *
  * @return void
  */
 protected function registerMorphs()
 {
     Relation::morphMap([\Silber\Bouncer\Database\Role::class, \Silber\Bouncer\Database\Ability::class]);
 }
Esempio n. 25
0
 /**
  * 設定 morphMap 關聯關係
  *
  * @return $this
  *
  * @link http://yish.im/2016/01/20/Laravel-morphMap-future/
  */
 protected function setMorphMap()
 {
     Relation::morphMap(['course' => \App\Ccu\Course::class, 'comment' => \App\Ccu\General\Comment::class]);
     return $this;
 }
Esempio n. 26
0
 /**
  * Bootstrap any application services.
  */
 public function boot()
 {
     // Set up the morph map for the polymorphic relationships
     Relation::morphMap(['project' => Project::class, 'template' => Template::class]);
 }
Esempio n. 27
0
 /**
  * Get the class name for polymorphic relations.
  *
  * @return string
  */
 public function getMorphClass()
 {
     $morphMap = Relation::morphMap();
     $class = get_class($this);
     if (!empty($morphMap) && in_array($class, $morphMap)) {
         return array_search($class, $morphMap, true);
     }
     return $this->morphClass ?: $class;
 }
Esempio n. 28
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     Relation::morphMap(['note' => Note::class, 'post' => Post::class, 'todo' => ToDo::class]);
 }