PHP code example of humweb / thingamabob

1. Go to this page and download the library: Download humweb/thingamabob 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/ */

    

humweb / thingamabob example snippets


return [
    'route' => '/api/widgets',
    'middleware' => [],
    'assets_path' => resource_path('js/widgets/'),
];

Widgets::resgister('stats', new StatsWiget());

class UserWidget extends AbstractWidget implements Widget
{
    public string $title = 'Users';
    public string $component = 'UserWidget';

    public function data(Request $request): Collection
    {
       return User::take(5)->get();
    }
}
bash
php artisan vendor:publish --tag="thingamabob-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="thingamabob-config"