From 8a660f08fe16aa3ed97bcdcfdff9fb4f68ef66df Mon Sep 17 00:00:00 2001 From: Jonas Regner Date: Sat, 25 May 2024 10:24:14 +0200 Subject: [PATCH] docs: write docs --- README.md | 118 +------------------------------ docs/README.md | 24 +++++++ docs/commands/make-action.md | 15 ++++ docs/commands/make-builder.md | 31 ++++++++ docs/commands/make-collection.md | 22 ++++++ docs/commands/make-command.md | 17 +++++ docs/commands/make-process.md | 1 + 7 files changed, 113 insertions(+), 115 deletions(-) create mode 100644 docs/README.md create mode 100644 docs/commands/make-action.md create mode 100644 docs/commands/make-builder.md create mode 100644 docs/commands/make-collection.md create mode 100644 docs/commands/make-command.md create mode 100644 docs/commands/make-process.md diff --git a/README.md b/README.md index 9356e46..6e7c73d 100644 --- a/README.md +++ b/README.md @@ -38,121 +38,9 @@ Register the namespaces inside your `composer.json`: ``` Run `composer dump-autoload` and everything is set up for using Laravel Beyond commands. -## Commands -### Overview -#### Application -- [`beyond:make:command`](#beyondmakecommand) -- `beyond:make:controller` -- `beyond:make:policy` -- `beyond:make:process` -- `beyond:make:query` -- `beyond:make:request` -- `beyond:make:resource` -- `beyond:make:rule` - -#### Domain -- [`beyond:make:action`](#beyondmakeaction) -- [`beyond:make:builder`](#beyondmakebuilder) -- [`beyond:make:collection`](#beyondmakecollection) -- `beyond:make:data` -- `beyond:make:enum` -- `beyond:make:event` -- `beyond:make:job` -- `beyond:make:listener` -- `beyond:make:model` -- `beyond:make:observer` - -### Detail -#### `beyond:make:action` -Creates a new action. An action does run one specific task, e.g. storing or updating a model. -If you need to do additional tasks like logging you should wrap those inside their own action -or (maybe better) consider using a process. - -##### Signature -`beyond:make:action {name} {--force}` - -| Parameters | Description | -|------------|------------------------| -| name | The name of you action | - -| Flags | Description | -|---------|-------------------------| -| --force | Overwrite existing file | ---- -#### `beyond:make:builder` -Creates a new Laravel Eloquent builder for a model. - -> [!NOTE] -> You need to add the builder to your model -> ``` -> public function newEloquentBuilder($q): YourBuilder -> { -> return new YourBuilder($q); -> } -> ``` - -> [!NOTE] -> For proper IDE support add the following docblock to you model -> ``` -> /** -> * @method static YourBuilder query() -> */ -> class User extends Model -> ``` - -##### Signature -`beyond:make:builder {name} {--force}` - -| Parameters | Description | -|------------|-------------------------| -| name | The name of you builder | - -| Flags | Description | -|---------|-------------------------| -| --force | Overwrite existing file | ---- -#### `beyond:make:collection` -Creates a new Laravel collection for a model. - -> [!NOTE] -> You need to add the collection to your model -> ``` -> public function newCollection($q): YourCollection -> { -> return new YourCollection($q); -> } -> ``` - -##### Signature -`beyond:make:collection {name} {--force}` - -| Parameters | Description | -|------------|----------------------------| -| name | The name of you collection | - -| Flags | Description | -|---------|-------------------------| -| --force | Overwrite existing file | ---- -#### `beyond:make:command` -Creates a new Laravel command. - -> [!NOTE] -> You need to add the command at `App\Console\Kernel`. - -##### Signature -`beyond:make:command {name} {--command=command:name} {--force}` - -| Parameters | Description | -|------------|-------------------------| -| name | The name of you command | - -| Flags | Description | -|-----------|-------------------------| -| --command | Define the command name | -| --force | Overwrite existing file | ---- - +## Documentation +Take a look at our documentation inside [`/docs`](docs/README.md) to learn about the available +commands and how to use them. ## Directory structure ``` diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..382cb20 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,24 @@ +# Documentation + +## Commands +### Application +- [`beyond:make:command`](commands/make-command.md) +- `beyond:make:controller` +- `beyond:make:policy` +- `beyond:make:process` +- `beyond:make:query` +- `beyond:make:request` +- `beyond:make:resource` +- `beyond:make:rule` + +### Domain +- [`beyond:make:action`](commands/make-action.md) +- [`beyond:make:builder`](commands/make-builder.md) +- [`beyond:make:collection`](commands/make-collection.md) +- `beyond:make:data` +- `beyond:make:enum` +- `beyond:make:event` +- `beyond:make:job` +- `beyond:make:listener` +- `beyond:make:model` +- `beyond:make:observer` diff --git a/docs/commands/make-action.md b/docs/commands/make-action.md new file mode 100644 index 0000000..f4f7080 --- /dev/null +++ b/docs/commands/make-action.md @@ -0,0 +1,15 @@ +# `beyond:make:action` +Creates a new action. An action does run one specific task, e.g. storing or updating a model. +If you need to do additional tasks like logging you should wrap those inside their own action +or (maybe better) consider using a [process](make-process.md). + +## Signature +`beyond:make:action {name} {--force}` + +| Parameters | Description | +|------------|------------------------| +| name | The name of you action | + +| Flags | Description | +|---------|-------------------------| +| --force | Overwrite existing file | diff --git a/docs/commands/make-builder.md b/docs/commands/make-builder.md new file mode 100644 index 0000000..823beb4 --- /dev/null +++ b/docs/commands/make-builder.md @@ -0,0 +1,31 @@ +# `beyond:make:builder` +Creates a new Laravel Eloquent builder for a model. + +> [!NOTE] +> You need to add the builder to your model +> ``` +> public function newEloquentBuilder($q): YourBuilder +> { +> return new YourBuilder($q); +> } +> ``` + +> [!NOTE] +> For proper IDE support add the following docblock to you model +> ``` +> /** +> * @method static YourBuilder query() +> */ +> class User extends Model +> ``` + +## Signature +`beyond:make:builder {name} {--force}` + +| Parameters | Description | +|------------|-------------------------| +| name | The name of you builder | + +| Flags | Description | +|---------|-------------------------| +| --force | Overwrite existing file | diff --git a/docs/commands/make-collection.md b/docs/commands/make-collection.md new file mode 100644 index 0000000..e40509b --- /dev/null +++ b/docs/commands/make-collection.md @@ -0,0 +1,22 @@ +# `beyond:make:collection` +Creates a new Laravel collection for a model. + +> [!NOTE] +> You need to add the collection to your model +> ``` +> public function newCollection($q): YourCollection +> { +> return new YourCollection($q); +> } +> ``` + +## Signature +`beyond:make:collection {name} {--force}` + +| Parameters | Description | +|------------|----------------------------| +| name | The name of you collection | + +| Flags | Description | +|---------|-------------------------| +| --force | Overwrite existing file | diff --git a/docs/commands/make-command.md b/docs/commands/make-command.md new file mode 100644 index 0000000..1d58d1a --- /dev/null +++ b/docs/commands/make-command.md @@ -0,0 +1,17 @@ +# `beyond:make:command` +Creates a new Laravel command. + +> [!NOTE] +> You need to add the command at `App\Console\Kernel`. + +## Signature +`beyond:make:command {name} {--command=command:name} {--force}` + +| Parameters | Description | +|------------|-------------------------| +| name | The name of you command | + +| Flags | Description | +|-----------|-------------------------| +| --command | Define the command name | +| --force | Overwrite existing file | diff --git a/docs/commands/make-process.md b/docs/commands/make-process.md new file mode 100644 index 0000000..fd6db71 --- /dev/null +++ b/docs/commands/make-process.md @@ -0,0 +1 @@ +# `beyond:make:process`