Added NSFW compatibility

This commit is contained in:
2026-06-27 18:57:26 +02:00
parent 4a7c43f9e7
commit 76a1e62129
8 changed files with 74 additions and 3 deletions

View File

@@ -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();
}
});
}