Enabled user registration

This commit is contained in:
Deon George
2018-12-25 12:48:57 +11:00
parent cb2d7936d0
commit 128002f434
26 changed files with 854 additions and 149 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Console\Commands;
use App\Models\Frame;
use App\Models\Mode;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\ModelNotFoundException;
@@ -15,9 +16,9 @@ class FrameImport extends Command
*/
protected $signature = 'frame:import {frame} {index} {file} '.
'{--access=0 : Is frame accessible }'.
'{--closed=1 : Is frame limited to CUG }'.
'{--public=0 : Is frame limited to CUG }'.
'{--cost=0 : Frame Cost }'.
'{--mode=1 : Frame Emulation Mode }'.
'{--mode=videotex : Frame Emulation Mode }'.
'{--replace : Replace existing frame}'.
'{--type=i : Frame Type}'.
'{--trim : Trim off header (first 40 chars)}';
@@ -56,12 +57,14 @@ class FrameImport extends Command
if (! file_exists($this->argument('file')))
throw new \Exception('File not found: '.$this->argument('file'));
$mo = Mode::where('name',$this->option('mode'))->firstOrFail();
$o = new Frame;
if ($this->option('replace')) {
try {
$o = $o->where('frame',$this->argument('frame'))
->where('index',$this->argument('index'))
->where('mode_id',$this->option('mode'))
->where('mode_id',$mo->id)
->firstOrFail();
} catch (ModelNotFoundException $e) {
@@ -72,7 +75,7 @@ class FrameImport extends Command
} else {
$o->frame = $this->argument('frame');
$o->index = $this->argument('index');
$o->mode_id = $this->option('mode');
$o->mode_id = $mo->id;
}
$o->content = ($this->option('trim'))
@@ -80,10 +83,10 @@ class FrameImport extends Command
: file_get_contents($this->argument('file'));
$o->access = $this->option('access');
$o->closed = $this->option('closed');
$o->public = $this->option('public');
$o->cost = $this->option('cost');
$o->type = $this->option('type');
$o->save();
}
}
}