Skip to content

Commit

Permalink
check if file exsite
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed-Elbanna-Git committed Sep 25, 2022
1 parent 6764fc5 commit 45a5612
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
4 changes: 4 additions & 0 deletions Console/GenerateAuthCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
39 changes: 19 additions & 20 deletions Helpers/Auth/AuthGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}

Expand Down

0 comments on commit 45a5612

Please # to comment.