%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/SubscribeAllDevicesToAllCategoriesJob.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 SubscribeAllDevicesToAllCategoriesJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Create a new job instance.
     */
    public function __construct()
    {

    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $categories = Category::all();
        Device::all()
              ->each(function (Device $device) use ($categories) {
                  foreach ($categories as $category) {
                      $device->enableConfiguration($category);
                  }
              });
    }
}

Zerion Mini Shell 1.0