Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
3m1n3nc3 authored Aug 29, 2024
1 parent c1708d7 commit 80128a4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@ php artisan mod:resource User --collection
php artisan mod:resource UserCollection
```

## Overwriting the `make:resource` command

If you want Laravel Resource Modifier to handle your `php artisan make:resource` command by default, you can create a new command named `ResourceMakeCommand` with the following signature:

```php
namespace App\Console\Commands;

use Symfony\Component\Console\Attribute\AsCommand;
use ToneflixCode\ResourceModifier\Commands\ResourceMakeCommand as ToneflixCodeResourceMakeCommand;

#[AsCommand(name: 'make:resource')]
class ResourceMakeCommand extends ToneflixCodeResourceMakeCommand
{
protected $name = 'make:resource';
}
```

This will overide the default `ResourceMakeCommand` as Laravel will prefer user defined commands over built in ones, so the next time you call `php artisan make:resource UserCollection`, your collection will be created with the Laravel Resource Modifier signature.

## Testing

```bash
Expand Down

0 comments on commit 80128a4

Please sign in to comment.