<?php

namespace App\Listeners\Ecommerce\Channel;

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class HideChannelProducts implements ShouldQueue
{
    use InteractsWithQueue;

    /**
     * Create the event listener.
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     */
    public function handle(object $event): void
    {
        $channel = $event->channel;

        $channel->products()->update(['products.is_visible' => boolval($channel->is_visible)]);
    }
}
