diff --git a/modules/Blog/Article/Entities/Comment.php b/modules/Blog/Article/Entities/Comment.php index 4b42d711..6fc5d45f 100644 --- a/modules/Blog/Article/Entities/Comment.php +++ b/modules/Blog/Article/Entities/Comment.php @@ -11,7 +11,8 @@ class Comment extends Model 'content_id', 'content', 'email', - 'name' + 'name', + 'approved' ]; public function author() diff --git a/modules/Blog/Article/Http/Controllers/Visitor/CreateNewComment.php b/modules/Blog/Article/Http/Controllers/Visitor/CreateNewComment.php index 7c68891a..ce295327 100644 --- a/modules/Blog/Article/Http/Controllers/Visitor/CreateNewComment.php +++ b/modules/Blog/Article/Http/Controllers/Visitor/CreateNewComment.php @@ -40,7 +40,8 @@ class CreateNewComment extends Controller 'content_id' => $article->id, 'name' => $name, 'email' => $email, - 'content' => $content + 'content' => $content, + 'approved' => !is_null($user) ]); // fire event about new comment diff --git a/modules/Blog/ArticleList/Providers/ArticleListServiceProvider.php b/modules/Blog/ArticleList/Providers/ArticleListServiceProvider.php index 5bd01754..c6b38d7c 100644 --- a/modules/Blog/ArticleList/Providers/ArticleListServiceProvider.php +++ b/modules/Blog/ArticleList/Providers/ArticleListServiceProvider.php @@ -1,92 +1,91 @@ registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + } - /** - * Boot the application events. - * - * @return void - */ - public function boot() - { - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - } + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + } - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - } + /** + * Register config. + * + * @return void + */ + protected function registerConfig() + { + $this->publishes([__DIR__ . '/../Config/config.php' => config_path('articlelist.php')]); + $this->mergeConfigFrom(__DIR__ . '/../Config/config.php', 'articlelist'); + } - /** - * Register config. - * - * @return void - */ - protected function registerConfig() - { - $this->publishes([__DIR__.'/../Config/config.php' => config_path('articlelist.php')]); - $this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'articlelist'); - } + /** + * Register views. + * + * @return void + */ + public function registerViews() + { + $viewPath = base_path('resources/views/modules/articlelist'); + $sourcePath = __DIR__ . '/../Resources/views'; + if (!is_dir($sourcePath)) { + return; + } - /** - * Register views. - * - * @return void - */ - public function registerViews() - { - $viewPath = base_path('resources/views/modules/articlelist'); - $sourcePath = __DIR__.'/../Resources/views'; + $this->publishes([$sourcePath => $viewPath]); - $this->publishes([$sourcePath => $viewPath]); + $this->loadViewsFrom(array_merge(array_map(function ($path) { + return $path . '/modules/articlelist'; + }, \Config::get('view.paths')), [$sourcePath]), 'articlelist'); + } - $this->loadViewsFrom(array_merge(array_map(function ($path) { - return $path . '/modules/articlelist'; - }, \Config::get('view.paths')), [$sourcePath]), 'articlelist'); - } + /** + * Register translations. + * + * @return void + */ + public function registerTranslations() + { + $langPath = base_path('resources/lang/modules/articlelist'); - /** - * Register translations. - * - * @return void - */ - public function registerTranslations() - { - $langPath = base_path('resources/lang/modules/articlelist'); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, 'articlelist'); - } else { - $this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'articlelist'); - } - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array(); - } + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, 'articlelist'); + } else { + $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'articlelist'); + } + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array (); + } }