Skip to content

Commit

Permalink
💅 Add a tag to the vendor config to publish (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-falcon authored Mar 31, 2021
1 parent 222a50b commit 092bcf3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Install via composer
composer require victor-falcon/laravel-task
```

## Usage
## Usage
### 1. Basic usage
Create a simple task using:

```
```bash
artisan task:make Shop/CreateUserShop
```

Expand Down Expand Up @@ -130,6 +130,13 @@ $product = CreateProduct::trigger()->withValid($data)->result();
## Generate IDE Help
In order to make more easy to write and use your task you can generate a `_ide_helper_tasks.php` file automatically with the `artisan task:ide-help` command.

## Update config
If you want, you can publish the package config to customize, for example, where do you want you task to be store at:

```shell
artisan vendor:publish --tag=laravel-task
```


## Credits
- [Víctor Falcón](https://github.com/victor-falcon)
Expand Down
7 changes: 6 additions & 1 deletion src/Console/Commands/MakeTaskCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ protected function getPath($name)
}

protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\\'.$this->getDefaultPath();
}

protected function getDefaultPath(): string
{
$default = config('laravel-task.folders', 'app/Tasks');
if (is_array($default)) {
Expand All @@ -32,6 +37,6 @@ protected function getDefaultNamespace($rootNamespace)

$default = Str::replaceFirst('app/', '', $default);

return is_dir(app_path($default)) ? $rootNamespace.'\\'.$default : $rootNamespace;
return $default;
}
}
2 changes: 1 addition & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function boot()
{
$this->publishes([
self::CONFIG_PATH => config_path('laravel-task.php'),
], 'config');
], ['config', 'laravel-task']);

if ($this->app->runningInConsole()) {
$this->commands([
Expand Down

0 comments on commit 092bcf3

Please sign in to comment.