robbens / laravel-dashboard-sl
瑞典斯德哥尔摩公共交通的实时更新。
2.0
2020-09-09 09:50 UTC
Requires
- php: ^7.4
- spatie/laravel-dashboard: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-30 00:53:24 UTC
README
Laravel Dashboard 的一个插件,显示来自 Stockholms Lokaltrafik 的实时公共交通数据。
安装
您可以通过 composer 安装此包。
composer require robbens/laravel-dashboard-sl
使用方法
在您的仪表板视图中,您使用 livewire:sl-tile 组件。
<x-dashboard> <livewire:sl-tile position="a1:a2" /> </x-dashboard>
配置 config/dashboard.php
[
// ...
'tiles' => [
'sl' => [
/**
* API key to SL Real-time information 4
*
* @link https://www.trafiklab.se/api/sl-realtidsinformation-4
*/
'api_key' => env('TRAFIKLAB_KEY'),
/**
* ID for the place for which the departures are to be collected, eg 9192 for Slussen.
* This ID can be found using the "SL Location Lookup Console".
*
* @link https://www.trafiklab.se/api/sl-platsuppslag/konsol
*/
'site_id' => 1079,
/**
* Optional label to show on the top of the tile.
*/
'site_label' => 'Odenplan',
/**
* Get departures within the desired time window. Where the
* time window is the number of minutes from now. Max 60.
*/
'time_window' => 60,
/**
* Transport modes limit.
*/
'buses' => [
'total_limit' => 5,
// Filter out early departures by minute. This is usually how long it takes to walk to the station.
'early_departures_limit' => 5,
],
'metros' => [
'total_limit' => 5,
'early_departures_limit' => null,
],
'trains' => false,
],
]
]
在 app/Console/Kernel.php 中安排命令。
protected function schedule(Schedule $schedule) { $schedule->command(Robbens\SlTile\FetchDataFromSLApiCommand::class)->everyMinute(); }
测试
composer test
变更日志
请参阅 CHANGELOG 以获取有关最近更改的更多信息。
贡献
请参阅 CONTRIBUTING 以获取详细信息。
安全性
如果您发现任何与安全性相关的问题,请通过电子邮件 yo@robin.se 反馈,而不是使用问题跟踪器。
致谢
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件。
