Files
nexusphp/app/Enums/ModelEventEnum.php

56 lines
2.0 KiB
PHP
Raw Normal View History

2025-04-17 01:39:40 +07:00
<?php
namespace App\Enums;
2025-06-19 13:13:26 +07:00
use App\Events\MessageCreated;
2025-04-17 01:39:40 +07:00
use App\Events\NewsCreated;
2025-06-17 20:54:18 +07:00
use App\Events\SnatchedUpdated;
2025-04-17 01:39:40 +07:00
use App\Events\TorrentCreated;
use App\Events\TorrentDeleted;
use App\Events\TorrentUpdated;
use App\Events\UserCreated;
use App\Events\UserDeleted;
use App\Events\UserDisabled;
use App\Events\UserEnabled;
use App\Events\UserUpdated;
2025-06-19 13:13:26 +07:00
use App\Models\Message;
2025-04-17 01:39:40 +07:00
use App\Models\News;
2025-06-17 20:54:18 +07:00
use App\Models\Snatch;
2025-04-17 01:39:40 +07:00
use App\Models\Torrent;
use App\Models\User;
final class ModelEventEnum {
const TORRENT_CREATED = 'torrent_created';
const TORRENT_UPDATED = 'torrent_updated';
const TORRENT_DELETED = 'torrent_deleted';
const USER_CREATED = 'user_created';
const USER_UPDATED = 'user_updated';
const USER_DELETED = 'user_deleted';
const USER_ENABLED = 'user_enabled';
const USER_DISABLED = 'user_disabled';
const NEWS_CREATED = 'news_created';
2025-06-17 20:54:18 +07:00
const SNATCHED_UPDATED = 'snatched_updated';
2025-06-19 13:13:26 +07:00
const MESSAGE_CREATED = 'message_created';
2025-06-17 20:54:18 +07:00
2025-04-17 01:39:40 +07:00
public static array $eventMaps = [
self::TORRENT_CREATED => ['event' => TorrentCreated::class, 'model' => Torrent::class],
self::TORRENT_UPDATED => ['event' => TorrentUpdated::class, 'model' => Torrent::class],
self::TORRENT_DELETED => ['event' => TorrentDeleted::class, 'model' => Torrent::class],
self::USER_CREATED => ['event' => UserCreated::class, 'model' => User::class],
self::USER_UPDATED => ['event' => UserUpdated::class, 'model' => User::class],
self::USER_DELETED => ['event' => UserDeleted::class, 'model' => User::class],
self::USER_ENABLED => ['event' => UserEnabled::class, 'model' => User::class],
self::USER_DISABLED => ['event' => UserDisabled::class, 'model' => User::class],
self::NEWS_CREATED => ['event' => NewsCreated::class, 'model' => News::class],
2025-06-17 20:54:18 +07:00
self::SNATCHED_UPDATED => ['event' => SnatchedUpdated::class, 'model' => Snatch::class],
2025-06-19 13:13:26 +07:00
self::MESSAGE_CREATED => ['event' => MessageCreated::class, 'model' => Message::class],
2025-04-17 01:39:40 +07:00
];
}