Skip to content

Commit 63915cc

Browse files
authored
Merge branch 'main' into feat/pages-and-sections
2 parents 0a2382f + c3aad43 commit 63915cc

3 files changed

Lines changed: 25 additions & 9 deletions

File tree

src/Models/Page.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@ class Page extends Model
1818
use HasFactory, HasTranslations, IsSearchable, SoftDeletes;
1919

2020
protected $table = 'cms_pages';
21+
22+
use HasFactory, HasTranslations, SoftDeletes;
2123

22-
public $translatable = ['title', 'short_text', 'long_text', 'sef_key'];
24+
protected $table = 'cms_pages';
25+
26+
public array $translatable = [
27+
'title',
28+
'short_text',
29+
'long_text',
30+
'sef_key'
31+
];
2332

2433
protected $fillable = [
2534
'title',

src/Models/Section.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,19 @@ class Section extends Model
1919
protected $table = 'cms_sections';
2020

2121
public $translatable = ['name'];
22-
23-
protected $casts = [
24-
'type' => SectionType::class,
25-
'name' => 'array',
22+
23+
public array $translatable = [
24+
'name',
2625
];
2726

27+
protected function casts(): array
28+
{
29+
return [
30+
'type' => SectionType::class,
31+
'name' => 'array',
32+
];
33+
}
34+
2835
public function getFillable()
2936
{
3037
$attr = [

tests/Unit/MenuItemTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@
195195

196196
it('can get tree formatted name', function () {
197197
$menu = Menu::factory()->create();
198-
$parent = Item::factory()->create(['menu_id' => $menu->id, 'label' => 'Parent']);
199-
$child = Item::factory()->create(['menu_id' => $menu->id, 'parent_id' => $parent->id, 'label' => 'Child']);
198+
$parent = Item::factory()->active()->create(['menu_id' => $menu->id, 'label' => 'Parent']);
199+
$child = Item::factory()->active()->create(['menu_id' => $menu->id, 'parent_id' => $parent->id, 'label' => 'Child']);
200200

201201
$parentFormatted = $parent->getTreeFormattedName();
202202
$childFormatted = $child->getTreeFormattedName();
@@ -207,11 +207,11 @@
207207

208208
it('can get full path', function () {
209209
$menu = Menu::factory()->create();
210-
$parent = Item::factory()->create([
210+
$parent = Item::factory()->active()->create([
211211
'menu_id' => $menu->id,
212212
'label' => ['en' => 'Parent Label'],
213213
]);
214-
$child = Item::factory()->create([
214+
$child = Item::factory()->active()->create([
215215
'menu_id' => $menu->id,
216216
'parent_id' => $parent->id,
217217
'label' => ['en' => 'Child Label'],

0 commit comments

Comments
 (0)