Skip to content

Commit

Permalink
docs: write docs
Browse files Browse the repository at this point in the history
  • Loading branch information
regnerisch committed May 24, 2024
1 parent 82f9bfd commit 1ecc3e6
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 157 deletions.
100 changes: 79 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*This package is inspired by "[Laravel Beyond CRUD](https://spatie.be/products/laravel-beyond-crud)" from Spatie
and "[Modularising the Monolith](https://www.youtube.com/watch?v=0Rq-yHAwYjQ&t=4129s)" from Ryuta Hamasaki.*


This package will help you with `beyond:make` commands to easily create classes inside your "Laravel Beyond CRUD"
inspired application.

Expand All @@ -16,13 +15,12 @@ Please read our [Upgrade Guide](UPGRADE.md) in case you are using an older versi

## Installation

Install laravel-beyond with composer

Install laravel-beyond with composer:
```bash
composer require --dev akrillia/laravel-beyond
```

Register the namespaces inside your `composer.json`.
Register the namespaces inside your `composer.json`:
```json
{
// ...
Expand All @@ -40,7 +38,83 @@ Register the namespaces inside your `composer.json`.
```
Run `composer dump-autoload` and everything is set up for using Laravel Beyond commands.

## Structure
## Commands
### Overview
#### Application
- `beyond:make:command`
- `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`
- `beyond:make:builder`
- `beyond:make:collection`
- `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 |



## Directory structure
```
|- src
| |- Application
Expand All @@ -67,22 +141,6 @@ Run `composer dump-autoload` and everything is set up for using Laravel Beyond c
| | | |- Observers
```

## Usage


## ToDo
### Commands
- `beyond:make:filter`
- `beyond:make:exception`
- `beyond:make:state`
- `beyond:make:value-object`
- `beyond:make:factory` (?)
- `beyond:make:migration` (?)
- `beyond:make:seeder` (?)
- `beyond:make:test` (?)
### Other
- Update command documentation

## Contributors

- [@regnerisch](https://github.com/regnerisch)
Expand Down
Empty file removed docs/.nojekyll
Empty file.
13 changes: 0 additions & 13 deletions docs/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/_sidebar.md

This file was deleted.

27 changes: 0 additions & 27 deletions docs/index.html

This file was deleted.

20 changes: 0 additions & 20 deletions docs/installation.md

This file was deleted.

20 changes: 0 additions & 20 deletions docs/make-action-command.md

This file was deleted.

51 changes: 0 additions & 51 deletions docs/upgrade.md

This file was deleted.

0 comments on commit 1ecc3e6

Please sign in to comment.