PHP code example of vzool / horizon

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

    

vzool / horizon example snippets


'providers' => [

    // ..

    Vzool\Horizon\HorizonServiceProvider::class,
],
'aliases' => [

    // ..

    "Horizon" => Vzool\Horizon\Horizon::class,
]



namespace App\Providers;

// ..

use Vzool\Horizon\Horizon;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        // ..

        // Add Horizon authentication [IGNORE IN DEV]
        
        Horizon::auth(function ($request) {
        
            // allow admins  only to see this page 
            // return \Auth::user()->is_admin;
            // or return any true / false
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

bash

php artisan vendor:publish