PHP code example of robbens / laravel-dashboard-sl

1. Go to this page and download the library: Download robbens/laravel-dashboard-sl library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

robbens / laravel-dashboard-sl example snippets


[
    // ...
    'tiles' => [
        'sl' => [
            /**
             * API key to SL Real-time information 4
             *
             * @link https://www.trafiklab.se/api/sl-realtidsinformation-4
             */
            'api_key' => env('TRAFIKLAB_KEY'),

            /**
             * ID for the place for which the departures are to be collected, eg 9192 for Slussen.
             * This ID can be found using the "SL Location Lookup Console".
             *
             * @link https://www.trafiklab.se/api/sl-platsuppslag/konsol
             */
            'site_id' => 1079,

            /**
             * Optional label to show on the top of the tile.
             */
            'site_label' => 'Odenplan',

            /**
             * Get departures within the desired time window. Where the
             * time window is the number of minutes from now. Max 60.
             */
            'time_window' => 60,

            /**
             * Transport modes limit.
             */
            'buses' => [
                'total_limit' => 5,
                // Filter out early departures by minute. This is usually how long it takes to walk to the station. 
                'early_departures_limit' => 5,
            ],
            'metros' => [
                'total_limit' => 5,
                'early_departures_limit' => null,
            ],
            'trains' => false,
        ], 
    ]   
]

protected function schedule(Schedule $schedule)
{
    $schedule->command(Robbens\SlTile\FetchDataFromSLApiCommand::class)->everyMinute();
}