kayschima / laravel-dashboard-footballdata-standings-tile
一个用于Laravel Dashboard显示不同联赛足球排名的瓷砖
1.0.1
2020-09-09 18:49 UTC
Requires
- php: ^7.4
- spatie/laravel-dashboard: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.3
README
该瓷砖可用于 Laravel Dashboard 显示来自 www.football-data.org 的排名。
许可证
MIT许可证(MIT)。有关更多信息,请参阅 许可证文件。
安装
您可以通过composer安装此瓷砖
composer require kayschima/laravel-dashboard-footballdata-standings-tile
在仪表板配置文件中,您必须在tiles键中添加此配置。
在 https://www.football-data.org/ 注册以获取 FOOTBALLDATA_API_KEY
。
将 FOOTBALL_LEAGUE
设置为 football-data.org 服务的联赛快捷方式(例如,BL1
或 PL
)。
// in config/dashboard.php return [ // ... 'tiles' => [ 'footballstandings' => [ 'footballdata_api_key' => env('FOOTBALLDATA_API_KEY'), 'football_league' => env('FOOTBALL_LEAGUE'), ] ], ];
在 app\Console\Kernel.php 中,您应该安排
Kayschima\FootballStandingsTile\Commands\FetchFootballStandingsDataCommand
和Kayschima\FootballStandingsTile\Commands\FetchFootballLiveResultsDataCommand
每分钟运行一次。
// in app/console/Kernel.php use Kayschima\FootballStandingsTile\Commands\FetchFootballStandingsDataCommand; use Kayschima\FootballStandingsTile\Commands\FetchFootballLiveResultsDataCommand; protected function schedule(Schedule $schedule) { // ... $schedule->command(FetchFootballStandingsDataCommand::class)->everyMinute(); $schedule->command(FetchFootballLiveResultsDataCommand::class)->everyMinute(); }
视图
在您的仪表板视图中,您使用
livewire:football-standings-tile
组件和/或livewire:football-live-results-tile
组件。
可选的 $highlight
-属性触发 livewire:football-standings-tile
的简单突出显示,例如本地或喜爱的球队,这可能是瓷砖的常见用例。
为了简单起见,此提交使用每个比赛特有的球队的id,例如,在本例中,BVB @ 1. Bundesliga 的 "4"
。
<x-dashboard> <livewire:football-standings-tile position="a1" highlight="4" /> <livewire:football-live-results-tile position="b1"/> </x-dashboard>
自定义视图
php artisan vendor:publish --provider="Kayschima\FootballStandingsTile\FootballStandingsTileServiceProvider" --tag="dashboard-football-standings-tile-views"