Skip to content

Commit 5900bb9

Browse files
committed
IMP: Udpate Quick Links Admin Panel.
1 parent a13da72 commit 5900bb9

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

database/factories/SettingFactory.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@ public function definition(): array
3333
'google_analytic_code' => '<script></script>',
3434
'google_adsense_code' => '<script></script>',
3535
'quick_links' => [
36-
$this->faker->word => $this->faker->url(),
37-
38-
$this->faker->word => $this->faker->url(),
39-
40-
$this->faker->word => $this->faker->url()
36+
[
37+
'label' => 'Home',
38+
'url' => $this->faker->url,
39+
],
40+
[
41+
'label' => 'About',
42+
'url' => $this->faker->url,
43+
],
44+
[
45+
'label' => 'Contact',
46+
'url' => $this->faker->url,
47+
],
4148
],
4249
];
4350
}

resources/views/layouts/app.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@
185185
</div>
186186
<div class="flex flex-col items-start gap-3 py-3 text-sm font-medium">
187187
<h4 class="text-xl font-semibold">Quick Links</h4>
188-
@forelse($setting->quick_links ?? [] as $title => $link)
189-
<a href="{{$link }}"
188+
@forelse($setting->quick_links ?? [] as $link)
189+
<a href="{{$link['url'] }}"
190190
class="transition duration-300 will-change-transform hover:translate-x-1 hover:text-black motion-reduce:transition-none motion-reduce:hover:transform-none">
191-
{{ $title }}
191+
{{ $link['label'] }}
192192
</a>
193193
@empty
194194
<p class="text-gray-300 font-semibold">No links found</p>

src/Models/Setting.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Filament\Forms\Components\FileUpload;
66
use Filament\Forms\Components\KeyValue;
7+
use Filament\Forms\Components\Repeater;
78
use Filament\Forms\Components\Section;
89
use Filament\Forms\Components\Textarea;
910
use Filament\Forms\Components\TextInput;
@@ -85,12 +86,20 @@ public static function getForm(): array
8586
Section::make('Quick Links')
8687
->description('Add your quick links here. This will be displayed in the footer of your blog.')
8788
->schema([
88-
KeyValue::make('quick_links')
89-
->label('Please add full url with http or https.')
90-
->keyLabel('Title')
91-
->valueLabel('URL')
92-
->columnSpanFull(),
93-
])->columns(2),
89+
Repeater::make('quick_links')
90+
->label('Links')
91+
->schema([
92+
TextInput::make('label')
93+
->required()
94+
->maxLength(155),
95+
TextInput::make('url')
96+
->label('URL')
97+
->helperText('URL should start with http:// or https://')
98+
->required()
99+
->url()
100+
->maxLength(255),
101+
])->columns(2),
102+
])->columnSpanFull(),
94103
];
95104
}
96105
}

0 commit comments

Comments
 (0)