Skip to content

Commit

Permalink
refactor: many things
Browse files Browse the repository at this point in the history
  • Loading branch information
regnerisch committed May 21, 2024
1 parent 3edcd8d commit 1cdf9a3
Show file tree
Hide file tree
Showing 55 changed files with 60 additions and 1,521 deletions.
413 changes: 10 additions & 403 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"suggest": {
"spatie/laravel-query-builder": "This package is required for Queries.",
"spatie/laravel-data": "This package is required for DataTransferObjects.",
"spatie/laravel-queueable-action": "This package is required for queueable Actions.",
"spatie/laravel-queueable-action": "This package is required for queueable actions.",
"qossmic/deptrac-shim": "This package can help you enforce architectural decisions by Laraval Beyond."
},
"config": {
Expand Down
16 changes: 0 additions & 16 deletions src/Commands/Abstracts/InfrastructureCommand.php

This file was deleted.

80 changes: 0 additions & 80 deletions src/Commands/MakeAppCommand.php

This file was deleted.

27 changes: 3 additions & 24 deletions src/Commands/MakeCollectionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,22 @@
namespace AkrilliA\LaravelBeyond\Commands;

use AkrilliA\LaravelBeyond\Commands\Abstracts\DomainCommand;
use AkrilliA\LaravelBeyond\NameResolver;
use AkrilliA\LaravelBeyond\Type;

final class MakeCollectionCommand extends DomainCommand
{
protected $signature = 'beyond:make:collection {name} {--model=} {--force}';
protected $signature = 'beyond:make:collection {name} {--force}';

protected $description = 'Make a new collection';

protected function getStub(): string
{
return $this->hasOption('model')
? 'collection.stub'
: 'collection.plain.stub';
return 'collection.stub';

}

public function getType(): Type
{
return new Type('Collection');
}

public function setup(NameResolver $fqn): void
{
if ($model = $this->option('model')) {
$command = new MakeModelCommand();
$fqn = $command->getNameResolver($fqn->getAppOrDomain().'.'.$model);

$this->mergePlaceholders([
'{{ modelNamespace }}' => $fqn->getNamespace(),
'{{ modelClassName }}' => $fqn->getClassName(),
]);

$this->addOnSuccess(function (string $namespace, string $className) use ($fqn) {
$this->call(MakeModelCommand::class, [
'name' => $fqn->getCommandNameArgument(),
]);
});
}
}
}
23 changes: 0 additions & 23 deletions src/Commands/MakeMiddlewareCommand.php

This file was deleted.

54 changes: 0 additions & 54 deletions src/Commands/MakeMigrationCommand.php

This file was deleted.

23 changes: 0 additions & 23 deletions src/Commands/MakeNotificationCommand.php

This file was deleted.

26 changes: 4 additions & 22 deletions src/Commands/MakePolicyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,22 @@

namespace AkrilliA\LaravelBeyond\Commands;

use AkrilliA\LaravelBeyond\Commands\Abstracts\DomainCommand;
use AkrilliA\LaravelBeyond\NameResolver;
use AkrilliA\LaravelBeyond\Commands\Abstracts\ApplicationCommand;
use AkrilliA\LaravelBeyond\Type;
use Illuminate\Support\Str;

final class MakePolicyCommand extends DomainCommand
final class MakePolicyCommand extends ApplicationCommand
{
protected $signature = 'beyond:make:policy {name} {--model=} {--force}';
protected $signature = 'beyond:make:policy {name} {--force}';

protected $description = 'Make a new policy';

protected function getStub(): string
{
return $this->option('model')
? 'policy.stub'
: 'policy.plain.stub';
return 'policy.stub';
}

public function getType(): Type
{
return new Type('Policy');
}

public function setup(NameResolver $fqn): void
{
if ($model = $this->option('model')) {
$command = new MakeModelCommand();
$fqn = $command->getNameResolver($fqn->getAppOrDomain().'.'.$model);

$this->mergePlaceholders([
'{{ modelNamespace }}' => $fqn->getNamespace(),
'{{ modelClassName }}' => $fqn->getClassName(),
'{{ modelVariable }}' => Str::camel($fqn->getClassName()),
]);
}
}
}
26 changes: 2 additions & 24 deletions src/Commands/MakeQueryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,21 @@
namespace AkrilliA\LaravelBeyond\Commands;

use AkrilliA\LaravelBeyond\Commands\Abstracts\ApplicationCommand;
use AkrilliA\LaravelBeyond\NameResolver;
use AkrilliA\LaravelBeyond\Type;

final class MakeQueryCommand extends ApplicationCommand
{
protected $signature = 'beyond:make:query {name} {--model=} {--force}';
protected $signature = 'beyond:make:query {name} {--force}';

protected $description = 'Make a new query';

protected function getStub(): string
{
return $this->option('model')
? 'query.stub'
: 'query.plain.stub';
return 'query.stub';
}

public function getType(): Type
{
return new Type('Query');
}

public function setup(NameResolver $nameResolver): void
{
if ($model = $this->option('model')) {
$command = new MakeModelCommand();
$fqn = $command->getNameResolver($nameResolver->getAppOrDomain().'.'.$model);

$this->mergePlaceholders([
'{{ modelNamespace }}' => $fqn->getNamespace(),
'{{ modelClassName }}' => $fqn->getClassName(),
]);

$this->addOnSuccess(function (string $namespace, string $className) use ($fqn) {
$this->call(MakeModelCommand::class, [
'name' => $fqn->getCommandNameArgument(),
]);
});
}
}
}
21 changes: 0 additions & 21 deletions src/Commands/PublishDeptracCommand.php

This file was deleted.

11 changes: 0 additions & 11 deletions src/Exceptions/AppDoesNotExistsException.php

This file was deleted.

Loading

0 comments on commit 1cdf9a3

Please sign in to comment.