astrotomic/laravel-dashboard-citybikes-tile

1.1.0 2020-09-14 10:49 UTC

This package is auto-updated.

Last update: 2024-10-29 06:12:05 UTC


README

Screenshot of Dashboard Tile

Latest Version MIT License Offset Earth Larabelles

GitHub Workflow Status StyleCI

Total Downloads Open Collective

This tile can be used on the Laravel Dashboard to display the status of Citybikes Stations - an API for bike services all over the world.

Installation

You can install the package via composer:

composer require astrotomic/laravel-dashboard-citybikes-tile

In the dashboard config file, you must add this configuration in the tiles key. The stations should contain the IDs of the Citybikes stations that you want to display on the dashboard.

// in config/dashboard.php

return [
    // ...
    'tiles' => [
        'citybikes' => [
            'network' => 'network-href', // http://api.citybik.es/v2/networks
            'stations' => [
                // IDs
            ],
            'refresh_interval_in_seconds' => 60,
        ],
    ],
];

In app\Console\Kernel.php you should schedule the \Astrotomic\CitybikesTile\FetchCitybikesStationsCommand to run. You can let it run every minute if you want. You could also run it less frequently if fast updates on the dashboard aren't that important for this tile.

// in app/console/Kernel.php

protected function schedule(Schedule $schedule)
{
    // ...
    $schedule->command(\Astrotomic\CitybikesTile\FetchCitybikesStationsCommand::class)->everyMinute();
}

Usage

In your dashboard view you use the livewire:citybikes-tile component.

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

Customizing the view

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

php artisan vendor:publish --provider="Astrotomic\CitybikesTile\CitybikesTileServiceProvider" --tag="dashboard-citybikes-tile-views"

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details. You could also be interested in CODE OF CONDUCT.

Security

If you discover any security related issues, please check SECURITY for steps to report it.

Credits

License

The MIT License (MIT). Please see License file for more information.

Treeware

You're free to use this package, but if it makes it to your production environment I would highly appreciate you buying the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees at offset.earth/treeware

Read more about Treeware at treeware.earth