%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/diaspora/api/app/Jobs/
Upload File :
Create Path :
Current File : /var/www/html/diaspora/api/app/Jobs/SubscribeAllDevicesToCategoryJob.php

<?php

namespace App\Jobs;

use App\Models\Category;
use App\Models\Device;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class SubscribeAllDevicesToCategoryJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    /**
     * @var Category
     */
    private $category;

    /**
     * Create a new job instance.
     *
     * @param Category $category
     */
    public function __construct(Category $category)
    {
        $this->category = $category;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        Device::all()
              ->each(function (Device $device) {
                  $device->enableConfiguration($this->category);
              });
    }
}

Zerion Mini Shell 1.0