FEATURE: add translations for comment logged events
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixForeignKeysOnActionLog extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('action_log', function (Blueprint $table) {
|
||||
$table->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
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
]
|
||||
];
|
||||
@@ -23,8 +23,6 @@
|
||||
<div class="card-footer">
|
||||
@lang('article::comments.createdAt', ['date' => \App\Helpers\Template::date($comment->created_at)]) |
|
||||
|
||||
|
||||
|
||||
@lang('article::comments.commentedArticle'): <a href="{{route('page.content', ['url' => $comment->article->url])}}" target="_blank">
|
||||
{{$comment->article->title}}
|
||||
</a>
|
||||
@@ -35,30 +33,11 @@
|
||||
data-toggle="tooltip"><i class="fa fa-fw fa-check"></i></a>
|
||||
@endif
|
||||
|
||||
<a href="{{route('comments.delete', ['id' => $comment->id])}}" class="btn btn-sm btn-warning"><i class="fa fa-fw fa-trash"></i></a>
|
||||
<a href="{{route('comments.delete', ['id' => $comment->id])}}" class="btn btn-sm confirm btn-warning"><i class="fa fa-fw fa-trash"></i></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{{--<div class="comment row">--}}
|
||||
{{--<div class="col-lg-2">--}}
|
||||
{{--<img class="img-rounded" src="@gravatar($comment->author->email)" alt="">--}}
|
||||
|
||||
{{--{{$comment->author->name}}--}}
|
||||
|
||||
{{--@date($comment->created_at)--}}
|
||||
|
||||
{{--</div>--}}
|
||||
{{--<div class="col-lg-10">{{$comment->content}}</div>--}}
|
||||
{{--<div class="col-lg2">--}}
|
||||
|
||||
|
||||
|
||||
{{--</div>--}}
|
||||
{{--</div>--}}
|
||||
@endforeach
|
||||
@else
|
||||
<div class="alert alert-info">
|
||||
|
||||
Reference in New Issue
Block a user