diff --git a/Console/GenerateAuthCommand.php b/Console/GenerateAuthCommand.php index 956e1dc..d656bb0 100644 --- a/Console/GenerateAuthCommand.php +++ b/Console/GenerateAuthCommand.php @@ -71,6 +71,10 @@ public function handle() $newGenerator->generateApi(); } + if($authType == 'web'){ + $newGenerator->generateWeb(); + } + $this->info('Generated Full Auth & Login With'.' '.$loginType .' '.' on the '.' '.$authType .' '.'Stage' ); } catch (Exception $e) { diff --git a/Helpers/Auth/AuthGenerator.php b/Helpers/Auth/AuthGenerator.php index 7ac57b0..5ae3c54 100644 --- a/Helpers/Auth/AuthGenerator.php +++ b/Helpers/Auth/AuthGenerator.php @@ -272,28 +272,27 @@ public function generateApi() if(!is_dir($path)){ File::makeDirectory($path); - $authController = view('auth::templates.api', [ - "sg" => $sg, - "sp" => $sp, - "model" => $model, - "table" => $this->table, - "module" => $this->module, - "cols" => $this->getFileds() - ]); + } + $authController = view('auth::templates.api', [ + "sg" => $sg, + "sp" => $sp, + "model" => $model, + "table" => $this->table, + "module" => $this->module, + "cols" => $this->getFileds() + ]); + $authRoutes = view('auth::templates.route', [ + "sg" => $sg, + "sp" => $sp, + "model" => $model, + "table" => $this->table, + "module" => $this->module, + "cols" => $this->getFileds() + ]); + File::put($path.$model . 'Auth.php', $authController); + file_put_contents($routePath.'api.php', $authRoutes); - $authRoutes = view('auth::templates.route', [ - "sg" => $sg, - "sp" => $sp, - "model" => $model, - "table" => $this->table, - "module" => $this->module, - "cols" => $this->getFileds() - ]); - File::put($path.$model . 'Auth.php', $authController); - file_put_contents($routePath.'api.php', $authRoutes); -// File::put($this->module.'/Routes/api.php', $authRoutes); - } }