Skip to content

Commit 9def524

Browse files
- README.md
1 parent 0f5624a commit 9def524

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,73 @@
11
# laravel-dashboard-gitlab-user-counts-tile
2+
---
3+
title: Time and Weather tile
4+
weight: 3
5+
---
6+
7+
This tile displays the time, weather, and optionally a rain forecast.
8+
9+
![screenshot](https://spatie.be/docs/laravel-dashboard/v2/images/time-weather.png)
10+
11+
## Installation
12+
13+
You can install the tile via composer:
14+
15+
```bash
16+
composer require spatie/laravel-dashboard-time-weather-tile
17+
```
18+
19+
In the `dashboard` config file, you must add this configuration in the `tiles` key.
20+
21+
Sign up at https://openweathermap.org/ to obtain `OPEN_WEATHER_MAP_KEY`
22+
23+
Head to https://www.buienradar.nl/ to get your cities `BUIENRADAR_LATITUDE`and `BUIENRADAR_LONGITUDE`
24+
25+
```php
26+
// in config/dashboard.php
27+
28+
return [
29+
// ...
30+
'tiles' => [
31+
'time_weather' => [
32+
'open_weather_map_key' => env('OPEN_WEATHER_MAP_KEY'),
33+
'open_weather_map_city' => 'Antwerp',
34+
'units' => 'metric', // 'metric' or 'imperial' (metric is default)
35+
'buienradar_latitude' => env('BUIENRADAR_LATITUDE'),
36+
'buienradar_longitude' => env('BUIENRADAR_LONGITUDE'),
37+
],
38+
],
39+
];
40+
```
41+
42+
In `app\Console\Kernel.php` you should schedule the `Spatie\TimeWeatherTile\FetchOpenWeatherMapDataCommand` to run every minute.
43+
44+
If you want to rain forecast, and the Buienradar service supports your location, you can optionally schedule the `Spatie\TimeWeatherTile\FetchBuienradarForecastsCommand` too.
45+
46+
```php
47+
// in app/console/Kernel.php
48+
49+
protected function schedule(Schedule $schedule)
50+
{
51+
// ...
52+
$schedule->command(\Spatie\TimeWeatherTile\Commands\FetchOpenWeatherMapDataCommand::class)->everyMinute();
53+
$schedule->command(\Spatie\TimeWeatherTile\Commands\FetchBuienradarForecastsCommand::class)->everyMinute();
54+
}
55+
```
56+
57+
## Usage
58+
59+
In your dashboard view you use the `livewire:time-weather-tile` component.
60+
61+
```html
62+
<x-dashboard>
63+
<livewire:time-weather-tile position="a1" />
64+
</x-dashboard>
65+
```
66+
67+
### Customizing the view
68+
69+
If you want to customize the view used to render this tile, run this command:
70+
71+
```bash
72+
php artisan vendor:publish --provider="Spatie\TimeWeatherTile\TimeWeatherTileServiceProvider" --tag="dashboard-time-weather-tile-views"
73+
```

0 commit comments

Comments
 (0)