Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
gogl92 authored and github-actions[bot] committed Oct 13, 2024
1 parent 94d6cd1 commit 08011b5
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/Commands/OrionTypescriptCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Inquid\LaravelGii\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Schema;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;

class OrionTypescriptCommand extends Command
Expand Down Expand Up @@ -32,8 +32,6 @@ class OrionTypescriptCommand extends Command

/**
* Create a new command instance.
*
* @param Repository $config
*/
public function __construct(Repository $config)
{
Expand All @@ -50,8 +48,9 @@ public function handle()
$controller = $this->argument('controller');
$modelClass = $this->getModelClassFromController($controller);

if (!class_exists($modelClass)) {
if (! class_exists($modelClass)) {
$this->error("Model for controller $controller does not exist.");

return;
}

Expand All @@ -66,20 +65,17 @@ public function handle()

/**
* Get the model class name from the controller name.
*
* @param string $controller
* @return string
*/
protected function getModelClassFromController(string $controller): string
{
$modelName = Str::replaceLast('Controller', '', $controller);

return "App\\Models\\$modelName";
}

/**
* Get the database connection for the model.
*
* @param $modelInstance
* @return string
*/
protected function getConnection($modelInstance)
Expand All @@ -89,9 +85,6 @@ protected function getConnection($modelInstance)

/**
* Get the schema name for the given connection.
*
* @param string $connection
* @return string
*/
protected function getSchema(string $connection): string
{
Expand All @@ -100,9 +93,6 @@ protected function getSchema(string $connection): string

/**
* Generate the Orion TypeScript model.
*
* @param string $controller
* @param string $table
*/
protected function generateOrionModel(string $controller, string $table)
{
Expand Down

0 comments on commit 08011b5

Please sign in to comment.