Move model observers onto attributes and tidy provider bindings.
Register observers with ObservedBy, bind the comment spam classifier, and keep AppServiceProvider focused on application wiring.
This commit is contained in:
@@ -4,48 +4,75 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Observers\HomepageAnnouncementObserver;
|
||||
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
#[ObservedBy([HomepageAnnouncementObserver::class])]
|
||||
class HomepageAnnouncement extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
public const STATUS_DRAFT = 'draft';
|
||||
|
||||
public const STATUS_PUBLISHED = 'published';
|
||||
|
||||
public const STATUS_ARCHIVED = 'archived';
|
||||
|
||||
public const TYPE_ANNOUNCEMENT = 'announcement';
|
||||
|
||||
public const TYPE_LAUNCH = 'launch';
|
||||
|
||||
public const TYPE_NEWS = 'news';
|
||||
|
||||
public const TYPE_WORLD = 'world';
|
||||
|
||||
public const TYPE_EVENT = 'event';
|
||||
|
||||
public const TYPE_NOTICE = 'notice';
|
||||
|
||||
public const TYPE_MAINTENANCE = 'maintenance';
|
||||
|
||||
public const PLACEMENT_HOMEPAGE_AFTER_FEATURED = 'homepage_after_featured';
|
||||
|
||||
public const LINK_TYPE_NONE = 'none';
|
||||
|
||||
public const LINK_TYPE_CUSTOM_URL = 'custom_url';
|
||||
|
||||
public const LINK_TYPE_NEWS = 'news';
|
||||
|
||||
public const LINK_TYPE_WORLD = 'world';
|
||||
|
||||
public const LINK_TYPE_ARTWORK = 'artwork';
|
||||
|
||||
public const LINK_TYPE_COLLECTION = 'collection';
|
||||
|
||||
public const LINK_TYPE_GROUP = 'group';
|
||||
|
||||
public const LINK_TYPE_PROFILE = 'profile';
|
||||
|
||||
public const LINK_TYPE_EXPLORE = 'explore';
|
||||
|
||||
public const LINK_TYPE_UPLOAD = 'upload';
|
||||
|
||||
public const GRADIENT_NOVA_AURORA = 'nova_aurora';
|
||||
|
||||
public const GRADIENT_DEEP_SPACE = 'deep_space';
|
||||
|
||||
public const GRADIENT_SUNRISE = 'sunrise';
|
||||
|
||||
public const GRADIENT_OCEAN_GLOW = 'ocean_glow';
|
||||
|
||||
public const GRADIENT_SPRING_VIBES = 'spring_vibes';
|
||||
|
||||
public const GRADIENT_FANTASY_REALMS = 'fantasy_realms';
|
||||
|
||||
public const GRADIENT_MINIMAL_LIGHT = 'minimal_light';
|
||||
|
||||
public const GRADIENT_DARK_GLASS = 'dark_glass';
|
||||
|
||||
protected $table = 'homepage_announcements';
|
||||
@@ -194,4 +221,4 @@ class HomepageAnnouncement extends Model
|
||||
{
|
||||
return $this->belongsTo(User::class, 'updated_by');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user