Time and Weather tile | laravel-dashboard | Spatie

 SPATIE

  Laravel Dashboard
====================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-dashboard](https://spatie.be/docs/laravel-dashboard/v3)  Adding-tiles  Time and Weather tile

 Version   v4   v3   v2   v1

 Other versions for crawler [v4](https://spatie.be/docs/laravel-dashboard/v4) [v3](https://spatie.be/docs/laravel-dashboard/v3) [v2](https://spatie.be/docs/laravel-dashboard/v2) [v1](https://spatie.be/docs/laravel-dashboard/v1)

- [ Introduction ](https://spatie.be/docs/laravel-dashboard/v3/introduction)
- [ Support us ](https://spatie.be/docs/laravel-dashboard/v3/support-us)
- [ Requirements ](https://spatie.be/docs/laravel-dashboard/v3/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-dashboard/v3/installation-setup)
- [ Upgrading ](https://spatie.be/docs/laravel-dashboard/v3/upgrading)
- [ Questions and issues ](https://spatie.be/docs/laravel-dashboard/v3/questions-issues)
- [ Changelog ](https://spatie.be/docs/laravel-dashboard/v3/changelog)
- [ About us ](https://spatie.be/docs/laravel-dashboard/v3/about-us)

Usage
-----

- [ Creating your first dashboard ](https://spatie.be/docs/laravel-dashboard/v3/basic-usage/creating-your-first-dashboard)
- [ Positioning tiles ](https://spatie.be/docs/laravel-dashboard/v3/basic-usage/positioning-tiles)
- [ Customizing the views ](https://spatie.be/docs/laravel-dashboard/v3/basic-usage/customizing-the-views)

Adding tiles
------------

- [ Overview ](https://spatie.be/docs/laravel-dashboard/v3/adding-tiles/overview)
- [ Creating your own tile ](https://spatie.be/docs/laravel-dashboard/v3/adding-tiles/creating-your-own-tile)
- [ Google calendar tile ](https://spatie.be/docs/laravel-dashboard/v3/adding-tiles/google-calendar)
- [ Time and Weather tile ](https://spatie.be/docs/laravel-dashboard/v3/adding-tiles/time-weather)
- [ Oh Dear Uptime tile ](https://spatie.be/docs/laravel-dashboard/v3/adding-tiles/oh-dear-uptime)
- [ Twitter tile ](https://spatie.be/docs/laravel-dashboard/v3/adding-tiles/twitter-tile)
- [ Velo tile ](https://spatie.be/docs/laravel-dashboard/v3/adding-tiles/velo)
- [ Belgian trains tile ](https://spatie.be/docs/laravel-dashboard/v3/adding-tiles/belgian-trains)
- [ Attendances tile ](https://spatie.be/docs/laravel-dashboard/v3/adding-tiles/attendances)

      You are viewing the documentation for **an older version** of this package. You can check the version you are using with the following command:

 `                                    composer show spatie/laravel-dashboard                                                                                                                                                                                                                                    `

Time and Weather tile
=====================

###  On this page

1. [ Installation ](#content-installation)
2. [ Usage ](#content-usage)

This tile displays the time, weather, and optionally a rain forecast.

![screenshot](https://spatie.be/docs/laravel-dashboard/v3/images/time-weather.png)

Installation
--------------------------------------------------------------------------------------------

You can install the tile via composer:

```
composer require spatie/laravel-dashboard-time-weather-tile
```

In the `dashboard` config file, you must add this configuration in the `tiles` key.

Sign up at https://openweathermap.org/ to obtain `OPEN_WEATHER_MAP_KEY`

Head to https://www.buienradar.nl/ to get your cities `BUIENRADAR_LATITUDE`and `BUIENRADAR_LONGITUDE`

```
// in config/dashboard.php

return [
    // ...
    'tiles' => [
        'time_weather' => [
            'open_weather_map_key' => env('OPEN_WEATHER_MAP_KEY'),
            'open_weather_map_city' => 'Antwerp',
            'units' => 'metric', // 'metric' or 'imperial' (metric is default)
            'buienradar_latitude' => env('BUIENRADAR_LATITUDE'),
            'buienradar_longitude' => env('BUIENRADAR_LONGITUDE'),
        ],
    ],
];
```

In `app\Console\Kernel.php` you should schedule the `Spatie\TimeWeatherTile\FetchOpenWeatherMapDataCommand` to run every minute.

If you want to rain forecast, and the Buienradar service supports your location, you can optionally schedule the `Spatie\TimeWeatherTile\FetchBuienradarForecastsCommand` too.

```
// in app/console/Kernel.php

protected function schedule(Schedule $schedule)
{
    // ...
    $schedule->command(\Spatie\TimeWeatherTile\Commands\FetchOpenWeatherMapDataCommand::class)->everyMinute();
    $schedule->command(\Spatie\TimeWeatherTile\Commands\FetchBuienradarForecastsCommand::class)->everyMinute();
}
```

Usage
-----------------------------------------------------------------------

In your dashboard view you use the `livewire:time-weather-tile` component.

```

```

### Customizing the view

If you want to customize the view used to render this tile, run this command:

```
php artisan vendor:publish --provider="Spatie\TimeWeatherTile\TimeWeatherTileServiceProvider" --tag="dashboard-time-weather-tile-views"
```
