providerToken($this->argument('user')); // Current Products used by services $products = Product::select(['products.*']) ->distinct('products.id') ->join('services',['services.product_id'=>'products.id']) ->where('services.active',TRUE) ->get(); foreach ($products as $po) { if (! $x=$po->provider_ref($to->provider)) $this->error(sprintf('Product [%03d](%s) doesnt have accounting set',$po->id,$po->name)); else $this->info(sprintf('Product [%03d](%s) set to accounting [%s]',$po->id,$po->name,$x)); } return self::SUCCESS; } }