Skip to content

Commit

Permalink
fixed repository contract filename
Browse files Browse the repository at this point in the history
  • Loading branch information
manchenkoff committed Oct 6, 2023
1 parent c537829 commit 6a29414
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Commands/RepositoryClassMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private function parseModel(string $model): string
private function createInterface(): void
{
$this->call('make:repository:contract', [
'name' => $this->getNameInput(),
'name' => $this->getNameInput() . 'Interface',
'model' => $this->argument('model'),
]);
}
Expand Down
8 changes: 2 additions & 6 deletions src/Commands/RepositoryContractMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ final class RepositoryContractMakeCommand extends GeneratorCommand

public function handle(): ?bool
{
if (!str_ends_with($this->getNameInput(), 'Repository')) {
$this->error('The repository name must end with "Repository" suffix!');
if (!str_ends_with($this->getNameInput(), 'Interface')) {
$this->error('The repository contract name must end with "Interface" suffix!');

return false;
}
Expand All @@ -47,10 +47,6 @@ protected function getDefaultNamespace($rootNamespace): string

protected function buildClass($name): string
{
if (!str_ends_with($name, 'Interface')) {
$name .= 'Interface';
}

$replace = [];
$replace = $this->buildModelReplacements($replace);

Expand Down

0 comments on commit 6a29414

Please sign in to comment.