mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-15 02:07:56 -04:00
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\StudioPlus\Console;
|
|
|
|
use Illuminate\Support\Str;
|
|
use Illuminate\Console\Command;
|
|
use Modules\StudioPlus\Entities\StudioPlusUser;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
use Modules\StudioPlus\Entities\StudioPlusChannel;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
|
|
class StudioPlusChannelCreate extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'studioplus:channel';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = "Create channel for users";
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
StudioPlusUser::query()
|
|
->whereDoesntHave('channel')
|
|
->each(function ($user) {
|
|
StudioPlusChannel::query()
|
|
->create(
|
|
[
|
|
'user_id' => $user->id,
|
|
'name' => Str::random(30)
|
|
]
|
|
);
|
|
});
|
|
}
|
|
}
|