Skip to content

Commit

Permalink
support Laravel 11 and add view more link
Browse files Browse the repository at this point in the history
  • Loading branch information
danilopolani committed Apr 7, 2024
1 parent 3157486 commit bfdf3ba
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
],
"require": {
"php": "^8.0",
"filament/filament": "^3.0 || 3.0-stable",
"illuminate/http": "^9.0 || ^10.0",
"illuminate/support": "^9.0 || ^10.0"
"filament/filament": "^3.0",
"illuminate/http": "^9.0|^10.0|^11.0",
"illuminate/support": "^9.0|^10.0|^11.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en/widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],

'footer' => [
'view_more' => 'View more',
'view_more' => 'View more statistics',
'statistics_by' => 'Statistics by',
],
];
2 changes: 1 addition & 1 deletion resources/lang/it/widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],

'footer' => [
'view_more' => 'Guarda di più',
'view_more' => 'Guarda più statistiche',
'statistics_by' => 'Statistiche da',
],
];
12 changes: 12 additions & 0 deletions src/Widgets/PlausibleWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

use DaniloPolani\FilamentPlausibleWidget\Clients\PlausibleClient;
use Filament\Widgets\ChartWidget;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\HtmlString;

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

public function getDescription(): string|Htmlable|null
{
return new HtmlString(sprintf(
'<a href="https://plausible.io/%s" target="_blank" class="text-primary-600 dark:text-primary-400">%s %s</a>',
Config::get('filament-plausible-widget.site_id'),
__('filament-plausible-widget::widget.footer.view_more'),
svg('heroicon-o-arrow-top-right-on-square', 'w-3 h-3 inline-block')->toHtml(),
));
}

protected function getType(): string
{
return 'line';
Expand Down

0 comments on commit bfdf3ba

Please sign in to comment.