%PDF- %PDF-
Direktori : /var/www/html/diaspora/api_internal/app/Jobs/ |
Current File : /var/www/html/diaspora/api_internal/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); } }); } }