Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed controller generator #194

Open
wants to merge 4 commits into
base: 8.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Generator/Commands/ControllerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
public array $inputs = [
['ui', null, InputOption::VALUE_OPTIONAL, 'The user-interface to generate the Controller for.'],
['stub', null, InputOption::VALUE_OPTIONAL, 'The stub file to load for this generator.'],
['model', null, InputOption::VALUE_OPTIONAL, 'The model you want to use for this controller.'],
];
/**
* The console command name.
Expand Down Expand Up @@ -50,6 +51,10 @@

public function getUserInputs(): array|null
{
// Name of the model (singular and plural)
$model = $this->checkParameterOrAsk('model', 'Model for the controller.', $this->containerName);
$models = Pluralizer::plural($model);

Check warning on line 56 in src/Generator/Commands/ControllerGenerator.php

View check run for this annotation

Codecov / codecov/patch

src/Generator/Commands/ControllerGenerator.php#L55-L56

Added lines #L55 - L56 were not covered by tests

$ui = Str::lower($this->checkParameterOrChoice('ui', 'Select the UI for the controller', ['API', 'WEB'], 0));

$stub = Str::lower(
Expand All @@ -66,10 +71,6 @@

$basecontroller = Str::ucfirst($ui) . 'Controller';

// Name of the model (singular and plural)
$model = $this->containerName;
$models = Pluralizer::plural($model);

$entity = Str::lower($model);
$entities = Pluralizer::plural($entity);

Expand Down