dustycodecorp/laravel-dashboard-tmb-tile

A TMB Bus tile for Spatie's Laravel dashboard

1.0.0 2020-05-15 15:10 UTC

This package is auto-updated.

Last update: 2024-04-15 23:20:53 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This tile can display the bus status for a given bus stop of Barcelona

img

This tile can be used on The Laravel Dashboard.

Installation

You can install the package via composer:

composer require dustycodecorp/laravel-dashboard-tmb-tile

Usage

NOTE: In order for this tile to work you will need the app_id and app_key from the TMB developer website the registration process is free and once you get the credentials you can ask for the information for as much stations as you want!.

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

// in config/dashboard.php

return [
    // ...
    'tiles' => [
        'tmb' => [
            'app_id' => 'Get this from the TMB developer web stie',
            'app_key' => 'Get this from the TMB developer web site',
            'refresh_interval_in_seconds' => 60,
            'stations' => [
                1103,
                1208
            ]
        ]  
    ]   
];

In app\Console\Kernel.php you should schedule the Dustycode\TmbTile\ListenForTmbUpdatesCommand to run. You can let in run every minute if you want. You could also run is less frequently if you fast updates on the dashboard aren’t that important for this tile.

// in app/console/Kernel.php

protected function schedule(Schedule $schedule)
{
    // ...
    $schedule->command(Dustycode\TmbTile\ListenForTmbUpdatesCommand::class)->everyMinute();
}

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

<x-dashboard>
    <livewire:tmb-tile position="c1:c2" title="Pl. Catalunya - Portal de l'Àngel" stop-id="1103"/>
</x-dashboard>

The title attribute is optional

Testing

composer test

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email :author_email instead of using the issue tracker.

Credits

License

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