Skip to content

Commit 23bd195

Browse files
AzGasimgithub-actions[bot]
authored andcommitted
Fix styling
1 parent 83f98ab commit 23bd195

File tree

11 files changed

+106
-109
lines changed

11 files changed

+106
-109
lines changed

packages/core/src/Entities/Items/Draft/BaseDraftResource.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ public static function getTitleColumn(): TextColumn
189189
$currentLang = $livewire->lang;
190190
$query->whereHas('translations', function ($query) use ($search, $currentLang) {
191191
$query->where('locale', $currentLang)
192-
->where('title', 'like', '%' . $search . '%');
192+
->where('title', 'like', '%'.$search.'%');
193193
});
194194
})
195195
->sortable()
196-
->extraAttributes(fn($record) => [
196+
->extraAttributes(fn ($record) => [
197197
'style' => $record->translations()->where('locale', request()->get('lang', app()->getLocale()))->withTrashed()->whereNotNull('title')->exists()
198198
? ''
199199
: 'color: var(--gray-500);',
@@ -212,7 +212,7 @@ public static function getTitleColumn(): TextColumn
212212
$fallbackTranslation = $record->translations()->where('locale', $defaultLang)->first();
213213

214214
if ($fallbackTranslation && $fallbackTranslation->title) {
215-
return $fallbackTranslation->title . ' (' . $defaultLang . ')';
215+
return $fallbackTranslation->title.' ('.$defaultLang.')';
216216
}
217217

218218
return 'No title available';
@@ -229,7 +229,7 @@ public static function getSlugColumn(): TextColumn
229229
$currentLang = request()->get('lang', $defaultLang);
230230
$query->whereHas('translations', function ($query) use ($search, $currentLang) {
231231
$query->where('locale', $currentLang)
232-
->where('slug', 'like', '%' . $search . '%');
232+
->where('slug', 'like', '%'.$search.'%');
233233
});
234234
})
235235
->sortable();
@@ -251,21 +251,21 @@ public static function getTranslationStatusSelect(): Select
251251
public static function getEditableTranslationStatusOptions(): array
252252
{
253253
return collect(TranslationStatus::cases())
254-
->filter(fn($case) => !in_array($case, [TranslationStatus::NOT_TRANSLATED, TranslationStatus::DELETED]))
255-
->mapWithKeys(fn($case) => [$case->value => ucfirst($case->value)])
254+
->filter(fn ($case) => ! in_array($case, [TranslationStatus::NOT_TRANSLATED, TranslationStatus::DELETED]))
255+
->mapWithKeys(fn ($case) => [$case->value => ucfirst($case->value)])
256256
->toArray();
257257
}
258258

259259
protected static function getCurrentTranslationStatus($record): string
260260
{
261-
if (!$record) {
261+
if (! $record) {
262262
return TranslationStatus::DRAFT->value;
263263
}
264264

265265
$currentLang = request()->get('lang', app()->getLocale());
266266
$translation = $record->translations()->where('locale', $currentLang)->first();
267267

268-
if (!$translation) {
268+
if (! $translation) {
269269
return TranslationStatus::NOT_TRANSLATED->value;
270270
}
271271

@@ -287,7 +287,7 @@ protected static function getDefaultStatus(): string
287287
public static function getTranslationStatusOptions(): array
288288
{
289289
return collect(TranslationStatus::cases())
290-
->mapWithKeys(fn($case) => [$case->value => ucfirst($case->value)])
290+
->mapWithKeys(fn ($case) => [$case->value => ucfirst($case->value)])
291291
->toArray();
292292
}
293293

@@ -310,8 +310,8 @@ public static function getPublishDateField(): DateTimePicker
310310
->label(__('core::core.to_publish_at'))
311311
->placeholder(__('core::core.to_publish_at'))
312312
->minDate(now())
313-
->hidden(fn($get) => $get('translation_status') !== 'scheduled')
314-
->dehydrateStateUsing(fn($state, $get) => $get('translation_status') === 'scheduled' ? $state : null);
313+
->hidden(fn ($get) => $get('translation_status') !== 'scheduled')
314+
->dehydrateStateUsing(fn ($state, $get) => $get('translation_status') === 'scheduled' ? $state : null);
315315
}
316316

317317
/**
@@ -323,8 +323,8 @@ public static function getUnpublishDateField(): DateTimePicker
323323
->label(__('core::core.to_unpublish_at'))
324324
->placeholder(__('core::core.to_unpublish_at'))
325325
->minDate(now())
326-
->hidden(fn($get) => !in_array($get('translation_status'), ['scheduled', 'published']))
327-
->dehydrateStateUsing(fn($state, $get) => in_array($get('translation_status'), ['scheduled', 'published']) ? $state : null);
326+
->hidden(fn ($get) => ! in_array($get('translation_status'), ['scheduled', 'published']))
327+
->dehydrateStateUsing(fn ($state, $get) => in_array($get('translation_status'), ['scheduled', 'published']) ? $state : null);
328328
}
329329

330330
/**
@@ -336,19 +336,19 @@ public static function getPublishedAtTextEntry(): TextEntry
336336
->label(__('core::core.published_at'))
337337
->state(function ($record): string {
338338
$translation = $record->translations()->withTrashed()->first();
339-
if (!$translation || !$translation->published_at) {
339+
if (! $translation || ! $translation->published_at) {
340340
return '';
341341
}
342342

343343
$publishedBy = '';
344344
if ($translation->published_by_id && $translation->published_by_type) {
345345
$user = app($translation->published_by_type)->find($translation->published_by_id);
346-
$publishedBy = $user ? ' ' . __('core::core.by') . ' ' . $user->name : '';
346+
$publishedBy = $user ? ' '.__('core::core.by').' '.$user->name : '';
347347
}
348348

349-
return $translation->published_at . ' - ' . $translation->published_at->diffForHumans() . $publishedBy;
349+
return $translation->published_at.' - '.$translation->published_at->diffForHumans().$publishedBy;
350350
})
351-
->hidden(fn($record) => !$record->published_at);
351+
->hidden(fn ($record) => ! $record->published_at);
352352
}
353353

354354
/**
@@ -358,9 +358,9 @@ public static function getToUnpublishAtTextEntry(): TextEntry
358358
{
359359
return TextEntry::make('to_unpublish_at')
360360
->label(__('core::core.to_unpublish_at'))
361-
->state(fn($record): string => $record->to_unpublish_at ?
362-
$record->to_unpublish_at . ' - ' . $record->to_unpublish_at->diffForHumans() : '')
363-
->hidden(fn($record) => !$record->to_unpublish_at);
361+
->state(fn ($record): string => $record->to_unpublish_at ?
362+
$record->to_unpublish_at.' - '.$record->to_unpublish_at->diffForHumans() : '')
363+
->hidden(fn ($record) => ! $record->to_unpublish_at);
364364
}
365365

366366
/**
@@ -389,7 +389,7 @@ function (Builder $query, $value): Builder {
389389
$defaultLang = $defaultLocalization?->locale_variant ?? app()->getLocale();
390390
$currentLang = request()->query('lang') ?? request()->get('lang') ?? $defaultLang;
391391

392-
if (!$value) {
392+
if (! $value) {
393393
return $query;
394394
}
395395

@@ -472,7 +472,7 @@ public static function getStatusColumn(): TextColumn
472472

473473
$translation = $record->translations()->withTrashed()->where('locale', $currentLang)->first();
474474

475-
if (!$translation) {
475+
if (! $translation) {
476476
return TranslationStatus::NOT_TRANSLATED;
477477
}
478478

packages/core/src/Entities/Items/Draft/Pages/BaseEditDraft.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function mount($record): void
4141
$localization = \Moox\Localization\Models\Localization::where('locale_variant', $this->lang)
4242
->where('is_active_admin', true)->first();
4343

44-
if (!$localization) {
44+
if (! $localization) {
4545
$defaultLocalization = \Moox\Localization\Models\Localization::where('is_default', true)->first();
4646
if ($defaultLocalization) {
4747
$this->redirect($this->getResource()::getUrl('edit', ['record' => $this->record, 'lang' => $defaultLocalization->locale_variant]));
@@ -53,7 +53,7 @@ public function mount($record): void
5353

5454
$translation = $this->record->translations()->withTrashed()->where('locale', $this->lang)->first();
5555

56-
if ($this->record->trashed() && !$translation) {
56+
if ($this->record->trashed() && ! $translation) {
5757
$defaultLocalization = \Moox\Localization\Models\Localization::where('is_default', true)->first();
5858
if ($defaultLocalization) {
5959
$this->redirect($this->getResource()::getUrl('edit', ['record' => $this->record, 'lang' => $defaultLocalization->locale_variant]));
@@ -73,7 +73,7 @@ public function mutateFormDataBeforeFill(array $data): array
7373
$record = $this->getRecord();
7474
$values = $data;
7575

76-
if (!method_exists($record, 'getTranslation') || !property_exists($record, 'translatedAttributes')) {
76+
if (! method_exists($record, 'getTranslation') || ! property_exists($record, 'translatedAttributes')) {
7777
return $values;
7878
}
7979

@@ -92,11 +92,11 @@ public function mutateFormDataBeforeFill(array $data): array
9292
protected function handleRecordUpdate(Model $record, array $data): Model
9393
{
9494
/** @var Model&TranslatableContract $record */
95-
if (!$this->lang) {
95+
if (! $this->lang) {
9696
return parent::handleRecordUpdate($record, $data);
9797
}
9898

99-
if (!property_exists($record, 'translatedAttributes')) {
99+
if (! property_exists($record, 'translatedAttributes')) {
100100
return parent::handleRecordUpdate($record, $data);
101101
}
102102

@@ -106,7 +106,7 @@ protected function handleRecordUpdate(Model $record, array $data): Model
106106

107107
$record->update($data);
108108

109-
if (!empty($translationData)) {
109+
if (! empty($translationData)) {
110110
$relation = $record->translations();
111111
$translationModel = $relation->getRelated();
112112
$foreignKey = $relation->getForeignKeyName();
@@ -115,7 +115,7 @@ protected function handleRecordUpdate(Model $record, array $data): Model
115115
->where('locale', $this->lang)
116116
->first();
117117

118-
if (!$translation) {
118+
if (! $translation) {
119119
$translation = $record->translations()->make([
120120
$relation->getForeignKeyName() => $record->id,
121121
'locale' => $this->lang,
@@ -138,7 +138,7 @@ public function mutateFormDataBeforeSave(array $data): array
138138
/** @var Model&TranslatableContract $model */
139139
$model = $this->getRecord();
140140

141-
if (!property_exists($model, 'translatedAttributes')) {
141+
if (! property_exists($model, 'translatedAttributes')) {
142142
return $data;
143143
}
144144

@@ -192,7 +192,7 @@ public function mutateFormDataBeforeSave(array $data): array
192192
];
193193

194194
foreach ($translatedFields as $field) {
195-
if (!isset($data[$field])) {
195+
if (! isset($data[$field])) {
196196
// Don't set protected fields to null automatically
197197
if (in_array($field, $protectedFields)) {
198198
continue;
@@ -226,10 +226,10 @@ public function getTitle(): string
226226

227227
$translation = $this->record->translations()->where('locale', $this->lang)->first();
228228

229-
if (!$translation) {
230-
return $entity . ' - ' . __('core::core.create');
229+
if (! $translation) {
230+
return $entity.' - '.__('core::core.create');
231231
}
232232

233-
return $entity . ' - ' . $translation->title;
233+
return $entity.' - '.$translation->title;
234234
}
235235
}

packages/core/src/Entities/Items/Draft/Pages/BaseListDrafts.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function mount(): void
3232
public function getTitle(): string
3333
{
3434
if ($this->activeTab === 'deleted') {
35-
return parent::getTitle() . ' - ' . __('core::core.trash');
35+
return parent::getTitle().' - '.__('core::core.trash');
3636
}
3737

3838
return parent::getTitle();
@@ -45,8 +45,8 @@ protected function getHeaderActions(): array
4545
{
4646
return [
4747
CreateAction::make()
48-
->using(fn(array $data, string $model): Model => $model::create($data))
49-
->hidden(fn(): bool => $this->activeTab === 'deleted'),
48+
->using(fn (array $data, string $model): Model => $model::create($data))
49+
->hidden(fn (): bool => $this->activeTab === 'deleted'),
5050
Action::make('emptyTrash')
5151
->label(__('core::core.empty_trash'))
5252
->icon('heroicon-o-trash')
@@ -64,7 +64,7 @@ protected function getHeaderActions(): array
6464
$this->redirect($this->getResource()::getUrl('index', ['lang' => $this->lang, 'tab' => 'all']));
6565
})
6666
->requiresConfirmation()
67-
->visible(fn(): bool => $this->activeTab === 'deleted' && $this->getModel()::onlyTrashed()->exists()),
67+
->visible(fn (): bool => $this->activeTab === 'deleted' && $this->getModel()::onlyTrashed()->exists()),
6868
];
6969
}
7070

packages/core/src/Entities/Items/Draft/Pages/BaseViewDraft.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ public function getTitle(): string
2020
{
2121
$title = parent::getTitle();
2222
if ($this->isRecordTrashed()) {
23-
$title = $title . ' - ' . __('core::core.deleted');
23+
$title = $title.' - '.__('core::core.deleted');
2424
}
2525

2626
return $title;
2727
}
2828

2929
protected function isRecordTrashed(): bool
3030
{
31-
if (!$this->record) {
31+
if (! $this->record) {
3232
return false;
3333
}
3434

@@ -64,7 +64,7 @@ public function mount($record): void
6464
$localization = \Moox\Localization\Models\Localization::where('locale_variant', $this->lang)
6565
->where('is_active_admin', true)->first();
6666

67-
if (!$localization) {
67+
if (! $localization) {
6868
$defaultLocalization = \Moox\Localization\Models\Localization::where('is_default', true)->first();
6969
if ($defaultLocalization) {
7070
$this->redirect($this->getResource()::getUrl('view', ['record' => $this->record, 'lang' => $defaultLocalization->locale_variant]));
@@ -81,7 +81,7 @@ public function mount($record): void
8181
return $trans->trashed();
8282
});
8383

84-
if ($allTranslationsDeleted && !$translation) {
84+
if ($allTranslationsDeleted && ! $translation) {
8585
$firstAvailableTranslation = $this->record->translations()->withTrashed()->first();
8686
if ($firstAvailableTranslation) {
8787
$this->redirect($this->getResource()::getUrl('view', ['record' => $this->record, 'lang' => $firstAvailableTranslation->locale]));

0 commit comments

Comments
 (0)