![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/job-board.corals.io/Corals/modules/Messaging/ |
<?php namespace Corals\Modules\Messaging; use Corals\Modules\Messaging\Models\Discussion; use Corals\Modules\Messaging\Models\Message; use Corals\Modules\Messaging\Models\Participation; use Corals\Modules\Messaging\Providers\MessagingAuthServiceProvider; use Corals\Modules\Messaging\Providers\MessagingObserverServiceProvider; use Corals\Modules\Messaging\Providers\MessagingRouteServiceProvider; use Corals\Settings\Facades\Settings; use Corals\User\Models\User; use Illuminate\Foundation\AliasLoader; use Illuminate\Support\ServiceProvider; class MessagingServiceProvider extends ServiceProvider { protected $defer = true; /** * Bootstrap the application events. * * @return void */ public function boot() { // Load view $this->loadViewsFrom(__DIR__ . '/resources/views', 'Messaging'); // Load translation $this->loadTranslationsFrom(__DIR__ . '/resources/lang', 'Messaging'); // Load migrations // $this->loadMigrationsFrom(__DIR__ . '/database/migrations'); $this->registerCustomFieldsModels(); } /** * @throws \ReflectionException */ public function register() { $this->mergeConfigFrom(__DIR__ . '/config/messaging.php', 'messaging'); $this->app->register(MessagingRouteServiceProvider::class); $this->app->register(MessagingAuthServiceProvider::class); $this->app->register(MessagingObserverServiceProvider::class); $this->app->booted(function () { $loader = AliasLoader::getInstance(); $loader->alias('Discussion', Discussion::class); $loader->alias('Message', Message::class); $loader->alias('Participation', Participation::class); }); $this->bindModels(); $messagable = new \Corals\Modules\Messaging\Hooks\Messagable(); User::mixin($messagable); } protected function registerCustomFieldsModels() { Settings::addCustomFieldModel(Discussion::class); Settings::addCustomFieldModel(Message::class); Settings::addCustomFieldModel(Participation::class); } /** * Bind the models. */ private function bindModels() { $this->app->bind(Contracts\Discussion::class, Discussion::class); $this->app->bind(Contracts\Message::class, Message::class); $this->app->bind(Contracts\Participation::class, Participation::class); } }