Skip to content

Commit bfdf3ba

Browse files
committed
support Laravel 11 and add view more link
1 parent 3157486 commit bfdf3ba

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
],
2121
"require": {
2222
"php": "^8.0",
23-
"filament/filament": "^3.0 || 3.0-stable",
24-
"illuminate/http": "^9.0 || ^10.0",
25-
"illuminate/support": "^9.0 || ^10.0"
23+
"filament/filament": "^3.0",
24+
"illuminate/http": "^9.0|^10.0|^11.0",
25+
"illuminate/support": "^9.0|^10.0|^11.0"
2626
},
2727
"autoload": {
2828
"psr-4": {

resources/lang/en/widget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616

1717
'footer' => [
18-
'view_more' => 'View more',
18+
'view_more' => 'View more statistics',
1919
'statistics_by' => 'Statistics by',
2020
],
2121
];

resources/lang/it/widget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616

1717
'footer' => [
18-
'view_more' => 'Guarda di più',
18+
'view_more' => 'Guarda più statistiche',
1919
'statistics_by' => 'Statistiche da',
2020
],
2121
];

src/Widgets/PlausibleWidget.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
use DaniloPolani\FilamentPlausibleWidget\Clients\PlausibleClient;
66
use Filament\Widgets\ChartWidget;
7+
use Illuminate\Contracts\Support\Htmlable;
78
use Illuminate\Support\Carbon;
89
use Illuminate\Support\Collection;
910
use Illuminate\Support\Facades\Cache;
1011
use Illuminate\Support\Facades\Config;
12+
use Illuminate\Support\HtmlString;
1113

1214
class PlausibleWidget extends ChartWidget
1315
{
@@ -25,6 +27,16 @@ public function getHeading(): string
2527
return __('filament-plausible-widget::widget.header.visitors');
2628
}
2729

30+
public function getDescription(): string|Htmlable|null
31+
{
32+
return new HtmlString(sprintf(
33+
'<a href="https://plausible.io/%s" target="_blank" class="text-primary-600 dark:text-primary-400">%s %s</a>',
34+
Config::get('filament-plausible-widget.site_id'),
35+
__('filament-plausible-widget::widget.footer.view_more'),
36+
svg('heroicon-o-arrow-top-right-on-square', 'w-3 h-3 inline-block')->toHtml(),
37+
));
38+
}
39+
2840
protected function getType(): string
2941
{
3042
return 'line';

0 commit comments

Comments
 (0)