public function configure_horizon()
    {

        // Require the queue_manager role to view the dashboard
        Horizon::auth(function ($request) {

            if (is_null($request->user()))
                return false;

            return $request->user()->has('queue_manager', false);
        });

        // attempt to parse the QUEUE_BALANCING variable into a boolean
        $balancing_mode = filter_var(env(self::QUEUE_BALANCING_MODE, false), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
        // in case the variable cannot be parsed into a boolean, assign the environment value itself
        if (is_null($balancing_mode))
            $balancing_mode = env(self::QUEUE_BALANCING_MODE, false);

        // Configure the workers for SeAT.
        $horizon_environments = [
            'local' => [
                'seat-workers' => [
                    'connection' => 'redis',
                    'queue'      => ['high', 'medium', 'low', 'default'],
                    'balance'    => $balancing_mode,
                    'processes'  => (int) env(self::QUEUE_BALANCING_WORKERS, 4),
                    'tries'      => 1,
                    'timeout'    => 900, // 15 minutes
                ],
            ],
        ];

        // Set the environment configuration.
        config(['horizon.environments' => $horizon_environments]);
    }
public function configure_horizon()
    {

        // Require the queue_manager role to view the dashboard
        Horizon::auth(function ($request) {

            if (is_null($request->user()))
                return false;

            return $request->user()->has('queue_manager', false);
        });

        // attempt to parse the QUEUE_BALANCING variable into a boolean
        $balancing_mode = filter_var(env(self::QUEUE_BALANCING_MODE, false), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
        // in case the variable cannot be parsed into a boolean, assign the environment value itself
        if (is_null($balancing_mode))
            $balancing_mode = env(self::QUEUE_BALANCING_MODE, false);

        // Configure the workers for SeAT.
        $horizon_environments = [
            'local' => [
                'seat-workers' => [
                    'connection' => 'redis',
                    'queue'      => ['high', 'medium', 'low', 'default'],
                    'balance'    => $balancing_mode,
                    'processes'  => (int) env(self::QUEUE_BALANCING_WORKERS, 4),
                    'tries'      => 1,
                    'timeout'    => 900, // 15 minutes
                ],
            ],
        ];

        // Set the environment configuration.
        config(['horizon.environments' => $horizon_environments]);
    }
public function configure_horizon ( ) { // Require the queue_manager role to view the dashboard Horizon :: auth ( function ( $ request ) { if ( is_null ( $ request -> user ( ) ) ) return false ; return $ request -> user ( ) -> has ( 'queue_manager' , false ) ; } ) ; // attempt to parse the QUEUE_BALANCING variable into a boolean $ balancing_mode = filter_var ( env ( self :: QUEUE_BALANCING_MODE , false ) , FILTER_VALIDATE_BOOLEAN , FILTER_NULL_ON_FAILURE ) ; // in case the variable cannot be parsed into a boolean, assign the environment value itself if ( is_null ( $ balancing_mode ) ) $ balancing_mode = env ( self :: QUEUE_BALANCING_MODE , false ) ; // Configure the workers for SeAT. $ horizon_environments = [ 'local' => [ 'seat-workers' => [ 'connection' => 'redis' , 'queue' => [ 'high' , 'medium' , 'low' , 'default' ] , 'balance' => $ balancing_mode , 'processes' => ( int ) env ( self :: QUEUE_BALANCING_WORKERS , 4 ) , 'tries' => 1 , 'timeout' => 900 , // 15 minutes ] , ] , ] ; // Set the environment configuration. config ( [ 'horizon.environments' => $ horizon_environments ] ) ; }
Configure Horizon.

This includes the access rules for the dashboard, as
well as the number of workers to use for the job processor.
Configure Horizon .