Skip to content

Commit

Permalink
status code append on response disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
hafijul233 committed Jun 5, 2024
1 parent cb5ed6c commit f49cce7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 41 deletions.
33 changes: 0 additions & 33 deletions src/Commands/ModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ public function handle(): int
}

$this->handleOptionalMigrationOption();
$this->handleOptionalControllerOption();
$this->handleOptionalSeedOption();
$this->handleOptionalRequestOption();

return 0;
}
Expand Down Expand Up @@ -90,21 +88,6 @@ private function createMigrationName()
return $string;
}

/**
* Create the controller file for the given model if controller flag was used
*/
private function handleOptionalControllerOption()
{
if ($this->option('controller') === true) {
$controllerName = "{$this->getModelName()}Controller";

$this->call('laraflow:make-controller', array_filter([
'controller' => $controllerName,
'module' => $this->argument('module'),
]));
}
}

/**
* @return mixed|string
*/
Expand All @@ -130,22 +113,6 @@ protected function handleOptionalSeedOption()
}
}

/**
* Create a request file for the model.
*
* @return void
*/
protected function handleOptionalRequestOption()
{
if ($this->option('request') === true) {
$requestName = "{$this->getModelName()}Request";

$this->call('laraflow:make-request', array_filter([
'name' => $requestName,
'module' => $this->argument('module'),
]));
}
}

/**
* Get the console command arguments.
Expand Down
16 changes: 8 additions & 8 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ function response_format($data, $statusCode = null): mixed
{
if (is_string($data)) {
$data = ['message' => $data];
if ($statusCode != null && config('fintech.core.append_status_code')) {
$data['code'] = $statusCode;
}
// if ($statusCode != null && config('api-crud.append_status_code')) {
// $data['code'] = $statusCode;
// }
}

if (is_array($data) && !isset($data['code'])) {
if ($statusCode != null && config('fintech.core.append_status_code')) {
$data['code'] = $statusCode;
}
}
// if (is_array($data) && !isset($data['code'])) {
// if ($statusCode != null && config('api-crud.append_status_code')) {
// $data['code'] = $statusCode;
// }
// }

return $data;
}
Expand Down

0 comments on commit f49cce7

Please sign in to comment.