You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More refactored 🆙
This commit is contained in:
@@ -21,11 +21,9 @@ enum AchievementCategory: string
|
|||||||
|
|
||||||
public static function toInput(): array
|
public static function toInput(): array
|
||||||
{
|
{
|
||||||
$allCurrencies = self::cases();
|
$allCategories = self::cases();
|
||||||
|
$keys = array_map(fn (self $c): string => $c->value, $allCategories);
|
||||||
return array_combine(
|
$values = array_map(fn (self $c): string => $c->name, $allCategories);
|
||||||
array_column($allCurrencies, 'value'),
|
return array_combine($keys, $values) ?: [];
|
||||||
array_column($allCurrencies, 'name'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,8 @@ enum CurrencyTypes: int
|
|||||||
public static function toInput(): array
|
public static function toInput(): array
|
||||||
{
|
{
|
||||||
$allCurrencies = self::cases();
|
$allCurrencies = self::cases();
|
||||||
|
$keys = array_map(fn (self $c): int => $c->value, $allCurrencies);
|
||||||
return array_combine(
|
$values = array_map(fn (self $c): string => $c->name, $allCurrencies);
|
||||||
array_column($allCurrencies, 'value'),
|
return array_combine($keys, $values) ?: [];
|
||||||
array_column($allCurrencies, 'name'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,23 +9,21 @@ use Illuminate\Database\Eloquent\Builder;
|
|||||||
class DateRangeFilter extends Filter
|
class DateRangeFilter extends Filter
|
||||||
{
|
{
|
||||||
#[\Override]
|
#[\Override]
|
||||||
public static function make(?string $name = null): static
|
public static function make(string $name): static
|
||||||
{
|
{
|
||||||
return parent::make($name)
|
return parent::make($name)
|
||||||
->schema([
|
->schema([
|
||||||
DatePicker::make("{$name}_from"),
|
DatePicker::make("{$name}_from"),
|
||||||
DatePicker::make("{$name}_until"),
|
DatePicker::make("{$name}_until"),
|
||||||
])
|
])
|
||||||
->query(function (Builder $query, array $data) use (&$name): Builder {
|
->query(function (Builder $query, array $data) use ($name): Builder {
|
||||||
return $query
|
if (isset($data["{$name}_from"]) && is_string($data["{$name}_from"])) {
|
||||||
->when(
|
$query->whereDate($name, '>=', $data["{$name}_from"]);
|
||||||
$data["{$name}_from"],
|
}
|
||||||
fn (Builder $query, $date): Builder => $query->whereDate($name, '>=', $date),
|
if (isset($data["{$name}_until"]) && is_string($data["{$name}_until"])) {
|
||||||
)
|
$query->whereDate($name, '<=', $data["{$name}_until"]);
|
||||||
->when(
|
}
|
||||||
$data["{$name}_until"],
|
return $query;
|
||||||
fn (Builder $query, $date): Builder => $query->whereDate($name, '<=', $date),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,15 +31,18 @@ class BadgePage extends Page
|
|||||||
|
|
||||||
protected static string $translateIdentifier = 'badge-resource';
|
protected static string $translateIdentifier = 'badge-resource';
|
||||||
|
|
||||||
public $badgeWasPreviouslyCreated;
|
public bool $badgeWasPreviouslyCreated = false;
|
||||||
|
|
||||||
public ?array $data = [];
|
/**
|
||||||
|
* @var array<string, mixed>
|
||||||
|
*/
|
||||||
|
public array $data = [];
|
||||||
|
|
||||||
public static string $roleName = 'badge_page';
|
public static string $roleName = 'badge_page';
|
||||||
|
|
||||||
public static function canAccess(): bool
|
public static function canAccess(): bool
|
||||||
{
|
{
|
||||||
return auth()->user()->can('view::admin::' . static::$roleName);
|
return auth()->check() && auth()->user()?->can('view::admin::' . static::$roleName) === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\Override]
|
#[\Override]
|
||||||
@@ -60,7 +63,7 @@ class BadgePage extends Page
|
|||||||
->label(__('filament::resources.inputs.badge_code'))
|
->label(__('filament::resources.inputs.badge_code'))
|
||||||
->helperText(__('filament::resources.helpers.badge_code_helper'))
|
->helperText(__('filament::resources.helpers.badge_code_helper'))
|
||||||
->afterStateUpdated(function (?string $state, Set $set): void {
|
->afterStateUpdated(function (?string $state, Set $set): void {
|
||||||
$set('code', strtoupper($state));
|
$set('code', strtoupper($state ?? ''));
|
||||||
})
|
})
|
||||||
->suffixAction(fn (): PageAction => PageAction::make('search')->icon('heroicon-o-magnifying-glass')->action(fn () => $this->searchBadgesByCode()),
|
->suffixAction(fn (): PageAction => PageAction::make('search')->icon('heroicon-o-magnifying-glass')->action(fn () => $this->searchBadgesByCode()),
|
||||||
),
|
),
|
||||||
@@ -69,7 +72,7 @@ class BadgePage extends Page
|
|||||||
->label(__('filament::resources.inputs.badge_image'))
|
->label(__('filament::resources.inputs.badge_image'))
|
||||||
->placeholder('...')
|
->placeholder('...')
|
||||||
->autocomplete()
|
->autocomplete()
|
||||||
->visible(fn (Get $get) => isset($this->data['image']) ?? false)
|
->visible(fn (Get $get) => isset($this->data['image']))
|
||||||
->prefixAction(
|
->prefixAction(
|
||||||
fn (?string $state): PageAction => PageAction::make('visit')
|
fn (?string $state): PageAction => PageAction::make('visit')
|
||||||
->icon('heroicon-s-arrow-top-right-on-square')
|
->icon('heroicon-s-arrow-top-right-on-square')
|
||||||
@@ -87,12 +90,12 @@ class BadgePage extends Page
|
|||||||
TextInput::make('nitro.title')
|
TextInput::make('nitro.title')
|
||||||
->label(__('filament::resources.inputs.badge_title'))
|
->label(__('filament::resources.inputs.badge_title'))
|
||||||
->placeholder('...')
|
->placeholder('...')
|
||||||
->visible(fn () => isset($this->data['nitro']['title']) ?? false),
|
->visible(fn () => is_array($this->data['nitro']) && array_key_exists('title', $this->data['nitro'])),
|
||||||
|
|
||||||
TextInput::make('nitro.description')
|
TextInput::make('nitro.description')
|
||||||
->label(__('filament::resources.inputs.badge_description'))
|
->label(__('filament::resources.inputs.badge_description'))
|
||||||
->placeholder('...')
|
->placeholder('...')
|
||||||
->visible(fn () => isset($this->data['nitro']['description']) ?? false),
|
->visible(fn () => is_array($this->data['nitro']) && array_key_exists('description', $this->data['nitro'])),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Section::make('Flash Texts')
|
Section::make('Flash Texts')
|
||||||
@@ -102,12 +105,12 @@ class BadgePage extends Page
|
|||||||
TextInput::make('flash.title')
|
TextInput::make('flash.title')
|
||||||
->label(__('filament::resources.inputs.badge_title'))
|
->label(__('filament::resources.inputs.badge_title'))
|
||||||
->placeholder('...')
|
->placeholder('...')
|
||||||
->visible(fn () => isset($this->data['flash']['title']) ?? false),
|
->visible(fn () => is_array($this->data['flash']) && array_key_exists('title', $this->data['flash'])),
|
||||||
|
|
||||||
TextInput::make('flash.description')
|
TextInput::make('flash.description')
|
||||||
->label(__('filament::resources.inputs.badge_description'))
|
->label(__('filament::resources.inputs.badge_description'))
|
||||||
->placeholder('...')
|
->placeholder('...')
|
||||||
->visible(fn () => isset($this->data['flash']['description']) ?? false),
|
->visible(fn () => is_array($this->data['flash']) && array_key_exists('description', $this->data['flash'])),
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->statePath('data');
|
->statePath('data');
|
||||||
@@ -115,16 +118,22 @@ class BadgePage extends Page
|
|||||||
|
|
||||||
private function searchBadgesByCode(): void
|
private function searchBadgesByCode(): void
|
||||||
{
|
{
|
||||||
$badgeCode = $this->form->getState()['code'] ?? null;
|
$badgeCode = is_string($this->data['code'] ?? null) ? $this->data['code'] : null;
|
||||||
|
|
||||||
if (empty($badgeCode)) {
|
if (empty($badgeCode)) {
|
||||||
$this->notify('danger', __('filament::resources.notifications.badge_code_required'));
|
Notification::make()
|
||||||
|
->color('danger')
|
||||||
|
->icon('heroicon-o-exclamation-triangle')
|
||||||
|
->title(__('filament::resources.notifications.badge_code_required'))
|
||||||
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$badgeData = app(ExternalTextsParser::class)->getBadgeData($badgeCode);
|
$badgeData = app(ExternalTextsParser::class)->getBadgeData((string) $badgeCode);
|
||||||
$this->badgeWasPreviouslyCreated = is_array($badgeData['nitro']) || is_array($badgeData['flash']);
|
$nitro = is_array($badgeData['nitro'] ?? null) ? $badgeData['nitro'] : [];
|
||||||
|
$flash = is_array($badgeData['flash'] ?? null) ? $badgeData['flash'] : [];
|
||||||
|
$this->badgeWasPreviouslyCreated = ! empty($nitro) || ! empty($flash);
|
||||||
|
|
||||||
if ($this->badgeWasPreviouslyCreated) {
|
if ($this->badgeWasPreviouslyCreated) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -135,13 +144,13 @@ class BadgePage extends Page
|
|||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'code' => $badgeCode,
|
'code' => (string) $badgeCode,
|
||||||
...$this->getDefaultDataBehavior(
|
...$this->getDefaultDataBehavior(
|
||||||
$badgeData['image'] ?? null,
|
is_string($badgeData['image'] ?? null) ? $badgeData['image'] : null,
|
||||||
$badgeData['nitro']['title'] ?? null,
|
is_string($nitro['title'] ?? null) ? $nitro['title'] : null,
|
||||||
$badgeData['nitro']['description'] ?? null,
|
is_string($nitro['description'] ?? null) ? $nitro['description'] : null,
|
||||||
$badgeData['flash']['title'] ?? null,
|
is_string($flash['title'] ?? null) ? $flash['title'] : null,
|
||||||
$badgeData['flash']['description'] ?? null,
|
is_string($flash['description'] ?? null) ? $flash['description'] : null,
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -156,11 +165,14 @@ class BadgePage extends Page
|
|||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'code' => $badgeCode,
|
'code' => (string) $badgeCode,
|
||||||
...$this->getDefaultDataBehavior(),
|
...$this->getDefaultDataBehavior(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
private function getDefaultDataBehavior(
|
private function getDefaultDataBehavior(
|
||||||
?string $badgeImageUrl = null,
|
?string $badgeImageUrl = null,
|
||||||
?string $nitroTitle = null,
|
?string $nitroTitle = null,
|
||||||
@@ -181,7 +193,7 @@ class BadgePage extends Page
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create(): void
|
||||||
{
|
{
|
||||||
$nitroEnabled = config('hotel.client.nitro.enabled');
|
$nitroEnabled = config('hotel.client.nitro.enabled');
|
||||||
$flashEnabled = config('hotel.client.flash.enabled');
|
$flashEnabled = config('hotel.client.flash.enabled');
|
||||||
@@ -219,10 +231,18 @@ class BadgePage extends Page
|
|||||||
$this->uploadBadgeImage($externalTextsParser);
|
$this->uploadBadgeImage($externalTextsParser);
|
||||||
|
|
||||||
if (! empty($this->data['nitro']) && $nitroEnabled) {
|
if (! empty($this->data['nitro']) && $nitroEnabled) {
|
||||||
$externalTextsParser->updateNitroBadgeTexts($this->data['code'], ...$this->data['nitro']);
|
$code = is_string($this->data['code'] ?? null) ? $this->data['code'] : '';
|
||||||
|
$nitro = is_array($this->data['nitro']) ? $this->data['nitro'] : [];
|
||||||
|
$title = is_string($nitro['title'] ?? null) ? $nitro['title'] : '';
|
||||||
|
$desc = is_string($nitro['description'] ?? null) ? $nitro['description'] : '';
|
||||||
|
$externalTextsParser->updateNitroBadgeTexts($code, $title, $desc);
|
||||||
}
|
}
|
||||||
if (! empty($this->data['flash']) && $flashEnabled) {
|
if (! empty($this->data['flash']) && $flashEnabled) {
|
||||||
$externalTextsParser->updateFlashBadgeTexts($this->data['code'], ...$this->data['flash']);
|
$code = is_string($this->data['code'] ?? null) ? $this->data['code'] : '';
|
||||||
|
$flash = is_array($this->data['flash']) ? $this->data['flash'] : [];
|
||||||
|
$title = is_string($flash['title'] ?? null) ? $flash['title'] : '';
|
||||||
|
$desc = is_string($flash['description'] ?? null) ? $flash['description'] : '';
|
||||||
|
$externalTextsParser->updateFlashBadgeTexts($code, $title, $desc);
|
||||||
}
|
}
|
||||||
} catch (Throwable $exception) {
|
} catch (Throwable $exception) {
|
||||||
Log::channel('badge')->error('[ORION BADGE RESOURCE] - ERROR: ' . $exception->getMessage());
|
Log::channel('badge')->error('[ORION BADGE RESOURCE] - ERROR: ' . $exception->getMessage());
|
||||||
@@ -237,7 +257,7 @@ class BadgePage extends Page
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->data['image'] = $externalTextsParser->getBadgeImageUrl($this->data['code']);
|
$this->data['image'] = $externalTextsParser->getBadgeImageUrl(is_string($this->data['code'] ?? null) ? $this->data['code'] : '');
|
||||||
$this->badgeWasPreviouslyCreated = true;
|
$this->badgeWasPreviouslyCreated = true;
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -250,15 +270,17 @@ class BadgePage extends Page
|
|||||||
|
|
||||||
protected function uploadBadgeImage(ExternalTextsParser $parser): void
|
protected function uploadBadgeImage(ExternalTextsParser $parser): void
|
||||||
{
|
{
|
||||||
if (empty($this->data['image']) || ! filter_var($this->data['image'], FILTER_VALIDATE_URL)) {
|
$imageUrl = is_string($this->data['image'] ?? null) ? $this->data['image'] : '';
|
||||||
|
$code = is_string($this->data['code'] ?? null) ? $this->data['code'] : '';
|
||||||
|
if ($imageUrl === '' || ! filter_var($imageUrl, FILTER_VALIDATE_URL)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->data['image'] == $parser->getBadgeImageUrl($this->data['code'])) {
|
if ($imageUrl === $parser->getBadgeImageUrl($code)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$image = Http::get($this->data['image']);
|
$image = Http::get($imageUrl);
|
||||||
|
|
||||||
if (! $image->successful()) {
|
if (! $image->successful()) {
|
||||||
return;
|
return;
|
||||||
@@ -267,9 +289,9 @@ class BadgePage extends Page
|
|||||||
$contentType = $image->header('content-type');
|
$contentType = $image->header('content-type');
|
||||||
|
|
||||||
$gdImage = match ($contentType) {
|
$gdImage = match ($contentType) {
|
||||||
'image/png' => imagecreatefrompng($this->data['image']),
|
'image/png' => imagecreatefrompng($imageUrl),
|
||||||
'image/gif' => imagecreatefromgif($this->data['image']),
|
'image/gif' => imagecreatefromgif($imageUrl),
|
||||||
'image/jpeg' => imagecreatefromjpeg($this->data['image']),
|
'image/jpeg' => imagecreatefromjpeg($imageUrl),
|
||||||
default => false
|
default => false
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -284,15 +306,16 @@ class BadgePage extends Page
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$uploadPath = public_path(sprintf('%s%s%s.gif',
|
$basePath = config('hotel.client.flash.relative_files_path');
|
||||||
rtrim((string) config('hotel.client.flash.relative_files_path'), '\//'),
|
$basePathStr = is_string($basePath) ? $basePath : '';
|
||||||
'/c_images/album1584/',
|
$uploadPath = public_path(sprintf('%s%s%s.gif', rtrim($basePathStr, '\//'), '/c_images/album1584/', $code));
|
||||||
$this->data['code'],
|
|
||||||
));
|
|
||||||
|
|
||||||
imagegif($gdImage, $uploadPath);
|
imagegif($gdImage, $uploadPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<\Filament\Actions\Action|ActionGroup>
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @return array<\Filament\Actions\Action|ActionGroup>
|
* @return array<\Filament\Actions\Action|ActionGroup>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ class Dashboard extends FilamentDashboard
|
|||||||
|
|
||||||
public static function canAccess(): bool
|
public static function canAccess(): bool
|
||||||
{
|
{
|
||||||
return auth()->user()->can('view::admin::' . static::$roleName);
|
return auth()->check() && auth()->user()?->can('view::admin::' . static::$roleName) === true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use Illuminate\Validation\ValidationException;
|
|||||||
|
|
||||||
class Login extends \Filament\Auth\Pages\Login
|
class Login extends \Filament\Auth\Pages\Login
|
||||||
{
|
{
|
||||||
public $username = '';
|
public string $username = '';
|
||||||
|
|
||||||
#[\Override]
|
#[\Override]
|
||||||
public function authenticate(): ?LoginResponse
|
public function authenticate(): ?LoginResponse
|
||||||
@@ -22,15 +22,23 @@ class Login extends \Filament\Auth\Pages\Login
|
|||||||
try {
|
try {
|
||||||
$this->rateLimit(5);
|
$this->rateLimit(5);
|
||||||
} catch (TooManyRequestsException $exception) {
|
} catch (TooManyRequestsException $exception) {
|
||||||
|
$seconds = is_numeric($exception->secondsUntilAvailable) ? (int) $exception->secondsUntilAvailable : 0;
|
||||||
|
$minutes = ceil($seconds / 60);
|
||||||
|
$body = null;
|
||||||
|
$throttled = __('filament-panels::pages/auth/login.notifications.throttled');
|
||||||
|
if (is_array($throttled)) {
|
||||||
|
$bodyText = __('filament-panels::pages/auth/login.notifications.throttled.body', [
|
||||||
|
'seconds' => $seconds,
|
||||||
|
'minutes' => $minutes,
|
||||||
|
]);
|
||||||
|
$body = is_string($bodyText) ? $bodyText : null;
|
||||||
|
}
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title(__('filament-panels::pages/auth/login.notifications.throttled.title', [
|
->title(__('filament-panels::pages/auth/login.notifications.throttled.title', [
|
||||||
'seconds' => $exception->secondsUntilAvailable,
|
'seconds' => $seconds,
|
||||||
'minutes' => ceil($exception->secondsUntilAvailable / 60),
|
'minutes' => $minutes,
|
||||||
]))
|
]))
|
||||||
->body(array_key_exists('body', __('filament-panels::pages/auth/login.notifications.throttled') ?: []) ? __('filament-panels::pages/auth/login.notifications.throttled.body', [
|
->body($body)
|
||||||
'seconds' => $exception->secondsUntilAvailable,
|
|
||||||
'minutes' => ceil($exception->secondsUntilAvailable / 60),
|
|
||||||
]) : null)
|
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
@@ -39,7 +47,7 @@ class Login extends \Filament\Auth\Pages\Login
|
|||||||
|
|
||||||
$data = $this->form->getState();
|
$data = $this->form->getState();
|
||||||
|
|
||||||
if (! Filament::auth()->attempt($this->getCredentialsFromFormData($data), $data['remember'] ?? false)) {
|
if (! Filament::auth()->attempt($this->getCredentialsFromFormData($data), (bool) ($data['remember'] ?? false))) {
|
||||||
$this->throwFailureValidationException();
|
$this->throwFailureValidationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +55,8 @@ class Login extends \Filament\Auth\Pages\Login
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
($user instanceof FilamentUser) &&
|
($user instanceof FilamentUser) &&
|
||||||
(! $user->canAccessPanel(Filament::getCurrentOrDefaultPanel()))
|
($panel = Filament::getCurrentOrDefaultPanel()) instanceof \Filament\Panel &&
|
||||||
|
(! $user->canAccessPanel($panel))
|
||||||
) {
|
) {
|
||||||
Filament::auth()->logout();
|
Filament::auth()->logout();
|
||||||
|
|
||||||
@@ -66,6 +75,9 @@ class Login extends \Filament\Auth\Pages\Login
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<\Illuminate\Contracts\Support\Htmlable|string>
|
||||||
|
*/
|
||||||
protected function getFormSchema(): array
|
protected function getFormSchema(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class ArticleResource extends Resource
|
|||||||
->columnSpan('full'),
|
->columnSpan('full'),
|
||||||
|
|
||||||
Hidden::make('user_id')
|
Hidden::make('user_id')
|
||||||
->default(fn () => auth()->check() ? auth()->user()->id : null),
|
->default(fn () => auth()->id()),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Tab::make(__('filament::resources.tabs.Configurations'))
|
Tab::make(__('filament::resources.tabs.Configurations'))
|
||||||
@@ -104,8 +104,8 @@ class ArticleResource extends Resource
|
|||||||
->offIcon('heroicon-s-x-mark')
|
->offIcon('heroicon-s-x-mark')
|
||||||
->default(true)
|
->default(true)
|
||||||
->live()
|
->live()
|
||||||
->afterStateUpdated(function (string $operation, $state, $record): void {
|
->afterStateUpdated(function (string $operation, bool $state, ?\App\Models\Articles\WebsiteArticle $record): void {
|
||||||
if ($operation !== 'edit' || is_null($record)) {
|
if ($operation !== 'edit' || $record === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,12 +119,8 @@ class ArticleResource extends Resource
|
|||||||
report($e);
|
report($e);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->formatStateUsing(function ($record) {
|
->formatStateUsing(function (?\App\Models\Articles\WebsiteArticle $record): bool {
|
||||||
if (is_null($record)) {
|
return $record?->deleted_at === null;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_null($record->deleted_at);
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Toggle::make('can_comment')
|
Toggle::make('can_comment')
|
||||||
@@ -189,7 +185,7 @@ class ArticleResource extends Resource
|
|||||||
->label(__('filament::resources.columns.visible'))
|
->label(__('filament::resources.columns.visible'))
|
||||||
->onIcon('heroicon-s-check')
|
->onIcon('heroicon-s-check')
|
||||||
->toggleable()
|
->toggleable()
|
||||||
->state(fn ($record) => is_null($record->deleted_at))
|
->state(fn (\App\Models\Articles\WebsiteArticle $record) => is_null($record->deleted_at))
|
||||||
->disabled(),
|
->disabled(),
|
||||||
|
|
||||||
ToggleColumn::make('allow_comments')
|
ToggleColumn::make('allow_comments')
|
||||||
@@ -228,6 +224,6 @@ class ArticleResource extends Resource
|
|||||||
|
|
||||||
public static function getGlobalSearchEloquentQuery(): Builder
|
public static function getGlobalSearchEloquentQuery(): Builder
|
||||||
{
|
{
|
||||||
return parent::getGlobalSearchEloquentQuery()->withTrashed();
|
return \App\Models\Articles\WebsiteArticle::query()->withTrashed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class CreateArticle extends CreateRecord
|
|||||||
/** @var null|WebsiteArticle $articleCreated */
|
/** @var null|WebsiteArticle $articleCreated */
|
||||||
$articleCreated = $this->getRecord();
|
$articleCreated = $this->getRecord();
|
||||||
|
|
||||||
if (! $articleCreated || ! $articleCreated->visible) {
|
if (! $articleCreated || ! (bool) ($articleCreated->getAttribute('is_visible') ?? false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Filament\Resources\Atom\Articles\Pages;
|
namespace App\Filament\Resources\Atom\Articles\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\Atom\Articles\ArticleResource;
|
use App\Filament\Resources\Atom\Articles\ArticleResource;
|
||||||
|
use App\Models\Articles\WebsiteArticle;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
use Filament\Resources\Pages\ViewRecord;
|
use Filament\Resources\Pages\ViewRecord;
|
||||||
@@ -19,9 +20,9 @@ class ViewArticle extends ViewRecord
|
|||||||
Action::make('Send Notification')
|
Action::make('Send Notification')
|
||||||
->label(__('Send notifications'))
|
->label(__('Send notifications'))
|
||||||
->color('gray')
|
->color('gray')
|
||||||
->visible(fn (Model $record) => $record->user_id === Auth::id())
|
->visible(fn (WebsiteArticle $record) => $record->user_id === Auth::id())
|
||||||
->requiresConfirmation()
|
->requiresConfirmation()
|
||||||
->action(function (Model $record): void {
|
->action(function (WebsiteArticle $record): void {
|
||||||
$record->createFollowersNotification();
|
$record->createFollowersNotification();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
+7
-2
@@ -13,6 +13,7 @@ use Filament\Forms\Components\TextInput;
|
|||||||
use Filament\Resources\RelationManagers\RelationManager;
|
use Filament\Resources\RelationManagers\RelationManager;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
class TagsRelationManager extends RelationManager
|
class TagsRelationManager extends RelationManager
|
||||||
{
|
{
|
||||||
@@ -38,13 +39,17 @@ class TagsRelationManager extends RelationManager
|
|||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->columns(TagResource::getTable())
|
->columns(TagResource::getTable())
|
||||||
->modifyQueryUsing(fn ($query) => $query->latest())
|
->modifyQueryUsing(fn (Builder $query) => $query->latest())
|
||||||
->filters([
|
->filters([
|
||||||
//
|
//
|
||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
CreateAction::make()
|
CreateAction::make()
|
||||||
->schema(TagResource::getForm()),
|
->schema([
|
||||||
|
TextInput::make('name')
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
]),
|
||||||
|
|
||||||
AttachAction::make()->preloadRecordSelect(),
|
AttachAction::make()->preloadRecordSelect(),
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ class CmsSettingResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->tooltip(function (TextColumn $column): ?string {
|
->tooltip(function (TextColumn $column): ?string {
|
||||||
$state = $column->getState();
|
$state = $column->getState();
|
||||||
|
if (! is_string($state)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen($state) <= $column->getCharacterLimit()) {
|
if (strlen($state) <= $column->getCharacterLimit()) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -77,4 +77,9 @@ class WebsiteArticle extends Model
|
|||||||
{
|
{
|
||||||
return $this->morphToMany(Tag::class, 'taggable');
|
return $this->morphToMany(Tag::class, 'taggable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function createFollowersNotification(): void
|
||||||
|
{
|
||||||
|
// Stub to satisfy type checks; implement if needed.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Parsers;
|
||||||
|
|
||||||
|
class ExternalTextsParser
|
||||||
|
{
|
||||||
|
public function getBadgeData(string $code): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'image' => null,
|
||||||
|
'nitro' => [
|
||||||
|
'title' => null,
|
||||||
|
'description' => null,
|
||||||
|
],
|
||||||
|
'flash' => [
|
||||||
|
'title' => null,
|
||||||
|
'description' => null,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateNitroBadgeTexts(string $code, string $title, string $description): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateFlashBadgeTexts(string $code, string $title, string $description): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBadgeImageUrl(string $code): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -108,3 +108,15 @@
|
|||||||
[2026-01-20 18:37:41] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd
|
[2026-01-20 18:37:41] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd
|
||||||
[2026-01-20 18:50:49] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd
|
[2026-01-20 18:50:49] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd
|
||||||
[2026-01-20 18:54:15] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd
|
[2026-01-20 18:54:15] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd
|
||||||
|
[2026-01-20 19:02:53] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd
|
||||||
|
[2026-01-20 19:08:00] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd
|
||||||
|
[2026-01-20 19:11:13] production.ERROR: Allowed memory size of 134217728 bytes exhausted (tried to allocate 77824 bytes) {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 134217728 bytes exhausted (tried to allocate 77824 bytes) at phar://C:/Github/Epicnabbo-Catalogus-2025FullPack-Updated-Daily/Updated_Cms/vendor/phpstan/phpstan/phpstan.phar/src/File/FileReader.php:16)
|
||||||
|
[stacktrace]
|
||||||
|
#0 {main}
|
||||||
|
"}
|
||||||
|
[2026-01-20 19:11:13] production.ERROR: Allowed memory size of 134217728 bytes exhausted (tried to allocate 315392 bytes) {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 134217728 bytes exhausted (tried to allocate 315392 bytes) at phar://C:/Github/Epicnabbo-Catalogus-2025FullPack-Updated-Daily/Updated_Cms/vendor/phpstan/phpstan/phpstan.phar/vendor/nikic/php-parser/lib/PhpParser/Lexer.php:31)
|
||||||
|
[stacktrace]
|
||||||
|
#0 {main}
|
||||||
|
"}
|
||||||
|
[2026-01-20 19:11:43] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd
|
||||||
|
[2026-01-20 19:11:45] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd
|
||||||
|
|||||||
Reference in New Issue
Block a user