diff --git a/database/migrations/2016_09_24_175541_FixForeignKeysOnActionLog.php b/database/migrations/2016_09_24_175541_FixForeignKeysOnActionLog.php new file mode 100644 index 00000000..c24b2248 --- /dev/null +++ b/database/migrations/2016_09_24_175541_FixForeignKeysOnActionLog.php @@ -0,0 +1,44 @@ +dropForeign('fk_action_log_action_log_type1'); + $table->dropForeign('fk_action_log_user1'); + + + $table->foreign('type_id') + ->references('id') + ->on('action_log_types') + ->onDelete('cascade') + ->onUpdate('cascade'); + + + $table->foreign('user_id') + ->references('id') + ->on('users') + ->onDelete('cascade') + ->onUpdate('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // do nothing + } +} diff --git a/modules/Blog/Article/Handlers/Article.php b/modules/Blog/Article/Handlers/Article.php index da7ad2ad..bc5481b9 100644 --- a/modules/Blog/Article/Handlers/Article.php +++ b/modules/Blog/Article/Handlers/Article.php @@ -4,12 +4,12 @@ namespace Modules\Blog\Article\Handlers; use App\Enumerations\ModulesHandlerToId; use App\Handlers\Contracts\ContentTitles; use App\Handlers\Handler; -use App\Http\Controllers\Admin\EditContent; +use App\Http\Controllers\Admin\Contents\EditContent; use App\Http\Controllers\Controller; use App\Http\Requests\Request; +use App\Models\ActionLogType; use App\Models\Content; use App\Models\User; -use Illuminate\Support\Facades\Artisan; use Modules\Blog\Article\Entities\Comment; class Article extends Handler implements ContentTitles @@ -90,9 +90,8 @@ class Article extends Handler implements ContentTitles return $changedColumns; } - - /** + * Register admin menu * * @param User $user */ @@ -129,13 +128,30 @@ class Article extends Handler implements ContentTitles /** * Install module - * - * @return mixed */ public static function install() { - // seed action log types -// Artisan::call('') + $types = [ + [ + 'string_id' => 'commentCreated', + 'name' => 'article::comments.events.names.commentCreated', + 'value' => 'article::comments.events.descriptions.commentCreated', + ], + [ + 'string_id' => 'commentDeleted', + 'name' => 'article::comments.events.names.commentDeleted', + 'value' => 'article::comments.events.descriptions.commentDeleted', + ], + [ + 'string_id' => 'commentApproved', + 'name' => 'article::comments.events.names.commentApproved', + 'value' => 'article::comments.events.descriptions.commentApproved', + ], + + ]; + foreach ($types as $type) { + ActionLogType::create($type); + } } /** diff --git a/modules/Blog/Article/Providers/ArticleServiceProvider.php b/modules/Blog/Article/Providers/ArticleServiceProvider.php index c05cc17a..188e2fef 100644 --- a/modules/Blog/Article/Providers/ArticleServiceProvider.php +++ b/modules/Blog/Article/Providers/ArticleServiceProvider.php @@ -59,7 +59,7 @@ class ArticleServiceProvider extends ServiceProvider { $viewPath = base_path('resources/views/modules/article'); $sourcePath = __DIR__.'/../Resources/views'; - $this->publishes([$sourcePath => $viewPath]); + $this->publishes([$sourcePath => $viewPath], 'module-views'); $this->loadViewsFrom(array_merge(array_map(function ($path) { return $path . '/modules/article'; diff --git a/modules/Blog/Article/Resources/lang/en/comments.php b/modules/Blog/Article/Resources/lang/en/comments.php index 8eb1d04c..9d8818cd 100644 --- a/modules/Blog/Article/Resources/lang/en/comments.php +++ b/modules/Blog/Article/Resources/lang/en/comments.php @@ -4,5 +4,18 @@ return [ 'commentedArticle' => 'Article', 'approve' => 'Approve comment', 'approved' => 'Comment successfully approved', - 'deleted' => 'Comment deleted' + 'deleted' => 'Comment deleted', + 'noComments' => 'No comments available', + 'events' => [ + 'names' => [ + 'commentCreated' => 'Added comment', + 'commentApproved' => 'Approved comment', + 'commentDeleted' => 'Deleted comment', + ], + 'descriptions' => [ + 'commentCreated' => 'Added comment from author :author with e-mail :email and following content: :content', + 'commentApproved' => 'Approved comment from author :author with e-mail :email and following content: :content', + 'commentDeleted' => 'Deleted comment from author :author with e-mail :email and following content: :content', + ], + ] ]; \ No newline at end of file diff --git a/modules/Blog/Article/Resources/views/admin/comments/overview.blade.php b/modules/Blog/Article/Resources/views/admin/comments/overview.blade.php index c7177e63..61a8c751 100644 --- a/modules/Blog/Article/Resources/views/admin/comments/overview.blade.php +++ b/modules/Blog/Article/Resources/views/admin/comments/overview.blade.php @@ -23,8 +23,6 @@ - - - - {{--
--}} - {{--
--}} - {{----}} - - {{--{{$comment->author->name}}--}} - - {{--@date($comment->created_at)--}} - - {{--
--}} - {{--
{{$comment->content}}
--}} - {{--
--}} - - - - {{--
--}} - {{--
--}} @endforeach @else