Added NSFW compatibility
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Helpers\EntryHelpers;
|
||||
use App\Models\Scopes\NsfwScope;
|
||||
use App\Traits\HasGallery;
|
||||
use App\Traits\HasXenforoUserId;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -137,7 +138,8 @@ class Entry extends Model
|
||||
'staff_comment',
|
||||
'rejected_at',
|
||||
'level_id',
|
||||
'created_at'
|
||||
'created_at',
|
||||
'nsfw'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -151,11 +153,15 @@ class Entry extends Model
|
||||
];
|
||||
|
||||
protected static function booted(): void {
|
||||
|
||||
static::addGlobalScope(new NsfwScope);
|
||||
|
||||
static::saving( function( $entry ) {
|
||||
if( $entry->isDirty('version') ) {
|
||||
$entry->created_at = now();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user