solitweb/laravel-dashboard-weather-forecast-tile

用于 Laravel Dashboard 的天气预报瓷砖

1.0.2 2022-07-13 07:09 UTC

This package is auto-updated.

Last update: 2024-09-13 12:00:42 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

此瓷砖显示天气预报。

此瓷砖可用于 Laravel Dashboard

安装

您可以通过 composer 安装此包。

composer require solitweb/laravel-dashboard-weather-forecast-tile

在仪表板配置文件中,您必须在 tiles 键中添加此配置。

// in config/dashboard.php

return [
    // ...
    'tiles' => [
        'weather_forecast' => [
            'open_weather_map_key' => env('OPEN_WEATHER_MAP_KEY'),
            'open_weather_map_city' => 'Antwerp',
            'units' => 'metric', // 'metric' or 'imperial' (metric is default)
            'locale' => 'en_US',
        ],
    ],
];

app\Console\Kernel.php 中,您应安排 Solitweb\WeatherForecastTile\FetchDataFromApiCommand 每分钟运行一次。

// in app/console/Kernel.php

protected function schedule(Schedule $schedule)
{
    // ...
    $schedule->command(\Solitweb\WeatherForecastTile\FetchDataFromApiCommand::class)->everyMinute();
}

使用方法

在您的仪表板视图中,您使用 livewire:weather-forecast-tile 组件。

<x-dashboard>
  <livewire:weather-forecast-tile position="a1" />
</x-dashboard>

自定义视图

如果您想自定义渲染此瓷砖所使用的视图,请运行此命令

php artisan vendor:publish --provider="Solitweb\WeatherForecastTile\WeatherForecastTileServiceProvider" --tag="dashboard-weather-forecast-tile-views"

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

贡献

请参阅 CONTRIBUTING 了解详细信息。

安全

如果您发现任何安全相关的问题,请通过电子邮件 stijn@solitweb.be 联系,而不是使用问题跟踪器。

鸣谢

许可协议

MIT 许可协议 (MIT)。请参阅 许可文件 了解更多。