Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/OpenVidu/RoomCreate.php
<?php | <?php | ||||
namespace App\Console\Commands\OpenVidu; | namespace App\Console\Commands\OpenVidu; | ||||
use Illuminate\Console\Command; | use App\Console\Command; | ||||
class RoomCreate extends Command | class RoomCreate extends Command | ||||
{ | { | ||||
/** | /** | ||||
* The name and signature of the console command. | * The name and signature of the console command. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $signature = 'openvidu:room-create {user} {room}'; | protected $signature = 'openvidu:room-create {user} {room}'; | ||||
/** | /** | ||||
* The console command description. | * The console command description. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $description = 'Create a room for a user'; | protected $description = 'Create a room for a user'; | ||||
/** | /** | ||||
* Create a new command instance. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function __construct() | |||||
{ | |||||
parent::__construct(); | |||||
} | |||||
/** | |||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$user = \App\User::where('email', $this->argument('user'))->first(); | $user = $this->getUser($this->argument('user')); | ||||
if (!$user) { | if (!$user) { | ||||
return 1; | return 1; | ||||
} | } | ||||
$roomName = $this->argument('room'); | $roomName = $this->argument('room'); | ||||
if (!preg_match('/^[a-zA-Z0-9_-]{1,16}$/', $roomName)) { | if (!preg_match('/^[a-zA-Z0-9_-]{1,16}$/', $roomName)) { | ||||
Show All 19 Lines |