Skip to content

Commit 55d3687

Browse files
Fix styling
1 parent 5da83e2 commit 55d3687

File tree

4 files changed

+16
-21
lines changed

4 files changed

+16
-21
lines changed

packages/draft/src/Models/Draft.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ public function handleSchedulingDates(): void
135135
$locale = request()->query('lang') ?? app()->getLocale();
136136
/** @var \Moox\Draft\Models\DraftTranslation|null $translation */
137137
$translation = $this->translate($locale);
138-
139-
if (!$translation) {
138+
139+
if (! $translation) {
140140
return;
141141
}
142142

packages/draft/src/Moox/Entities/Drafts/Draft/Pages/CreateDraft.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
namespace Moox\Draft\Moox\Entities\Drafts\Draft\Pages;
44

5+
use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
56
use Illuminate\Database\Eloquent\Model;
67
use Moox\Core\Entities\Items\Draft\Pages\BaseCreateDraft;
7-
use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
88

99
class CreateDraft extends BaseCreateDraft
1010
{
11-
1211
public ?string $lang = null;
1312

1413
public function mount(): void
@@ -27,8 +26,8 @@ protected function handleRecordCreation(array $data): Model
2726
$record->setDefaultLocale($this->lang);
2827

2928
// Get translatable and non-translatable attributes
30-
$translatableAttributes = property_exists($record, 'translatedAttributes')
31-
? $record->translatedAttributes
29+
$translatableAttributes = property_exists($record, 'translatedAttributes')
30+
? $record->translatedAttributes
3231
: [];
3332
$translationData = array_intersect_key($data, array_flip($translatableAttributes));
3433
$nonTranslatableData = array_diff_key($data, array_flip($translatableAttributes));
@@ -66,5 +65,4 @@ protected function getRedirectUrl(): string
6665
{
6766
return $this->getResource()::getUrl('index', ['lang' => $this->lang]);
6867
}
69-
7068
}

packages/draft/src/Moox/Entities/Drafts/Draft/Pages/EditDraft.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
namespace Moox\Draft\Moox\Entities\Drafts\Draft\Pages;
44

5+
use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
56
use Illuminate\Database\Eloquent\Model;
67
use Moox\Core\Entities\Items\Draft\Pages\BaseEditDraft;
7-
use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
88

99
class EditDraft extends BaseEditDraft
1010
{
11-
1211
public ?string $lang = null;
1312

1413
public function mount($record): void
@@ -21,11 +20,11 @@ public function mutateFormDataBeforeFill(array $data): array
2120
{
2221
/** @var Model&TranslatableContract $record */
2322
$record = $this->getRecord();
24-
25-
if (!property_exists($record, 'translatedAttributes')) {
23+
24+
if (! property_exists($record, 'translatedAttributes')) {
2625
return $data;
2726
}
28-
27+
2928
$translatable = $record->translatedAttributes;
3029
$values = [];
3130
foreach ($translatable as $attr) {
@@ -37,12 +36,12 @@ public function mutateFormDataBeforeFill(array $data): array
3736

3837
protected function handleRecordUpdate(Model $record, array $data): Model
3938
{
40-
if (!$this->lang) {
39+
if (! $this->lang) {
4140
return parent::handleRecordUpdate($record, $data);
4241
}
4342

4443
/** @var Model&TranslatableContract $record */
45-
if (!property_exists($record, 'translatedAttributes')) {
44+
if (! property_exists($record, 'translatedAttributes')) {
4645
return parent::handleRecordUpdate($record, $data);
4746
}
4847

@@ -66,8 +65,8 @@ public function mutateFormDataBeforeSave(array $data): array
6665
{
6766
/** @var Model&TranslatableContract $model */
6867
$model = $this->getRecord();
69-
70-
if (!property_exists($model, 'translatedAttributes')) {
68+
69+
if (! property_exists($model, 'translatedAttributes')) {
7170
return $data;
7271
}
7372

packages/draft/src/Moox/Entities/Drafts/Draft/Pages/ViewDraft.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,22 @@
66

77
class ViewDraft extends BaseViewDraft
88
{
9-
109
public ?string $lang = null;
1110

1211
public function mount($record): void
1312
{
14-
1513
$this->lang = request()->query('lang', app()->getLocale());
1614
parent::mount($record);
1715
}
1816

1917
public function mutateFormDataBeforeFill(array $data): array
2018
{
2119
$record = $this->getRecord();
22-
23-
if (!method_exists($record, 'getTranslation') || !property_exists($record, 'translatedAttributes')) {
20+
21+
if (! method_exists($record, 'getTranslation') || ! property_exists($record, 'translatedAttributes')) {
2422
return $data;
2523
}
26-
24+
2725
$translatable = $record->translatedAttributes;
2826
$values = [];
2927
foreach ($translatable as $attr) {

0 commit comments

Comments
 (0)