/laravel-dashboard-reddit-tile

A reddit tile for Spatie's Laravel Dashboard

Primary LanguagePHPMIT LicenseMIT

Reddit tile for Laravel Dashboard.

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This tile can display a list of the post to your favorite subreddit.

img

This tile can be used on the Laravel Dashboard.

Installation

You can install the package via composer:

composer require jeop10/laravel-dashboard-reddit-tile

Usage

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

// in config/dashboard.php

return [
    // ...
    'tiles' => [
        'reddit' => [
            'general' => [
                'useragent' => 'web:laravel-dashboard-reddit-tile:0.1',
                'timezone' => 'Your desired timezone', //Important to get the posted at
            ],
            'configurations' => [
                'default' => [
                    'subreddit' => 'aww',
                    'sort_by' => 'hot', // valid values are hot, new, rising, controversial, top
                    'refresh_interval_in_seconds' => 120,
                ],
                'covid' => [
                    'subreddit' => 'coronavirus',
                    'sort_by' => 'new',
                    'refresh_interval_in_seconds' => 60,
                ],
                //...
            ]
        ]   
    ]   
];

In app\Console\Kernel.php you should schedule the Dustycode\RedditTile\ListenForRedditPostsCommand 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\RedditTile\ListenForRedditPostsCommand::class)->everyMinute();
}

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

<x-dashboard>
    <livewire:reddit-tile position="a1:a4" configuration-name="default" title="r/Aww"/>
</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.