Skip to content

Commit

Permalink
added install command
Browse files Browse the repository at this point in the history
  • Loading branch information
justijndepover committed Oct 16, 2020
1 parent cba6a03 commit cee2bed
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You can install the package with composer
composer require justijndepover/laravel-inbox
```

After the installation, you should publish the assets
After the installation, you have to publish the assets
```
php artisan inbox:install
```
Expand Down
26 changes: 26 additions & 0 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Justijndepover\Inbox\Console;

use Illuminate\Console\Command;

class InstallCommand extends Command
{
protected $signature = 'inbox:install {--config : publish the configuration file}';

protected $description = 'Install all of the Laravel Inbox resources';

public function handle()
{
$this->comment('Publishing assets...');

$this->callSilent('vendor:publish', ['--tag' => 'laravel-inbox-assets']);

if ($this->option('config')) {
$this->comment('Publishing configuration...');
$this->callSilent('vendor:publish', ['--tag' => 'laravel-inbox-config']);
}

$this->info('Laravel Inbox installed successfully.');
}
}
5 changes: 4 additions & 1 deletion src/InboxServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
use Justijndepover\Inbox\Console\InstallCommand;
use Justijndepover\Inbox\Listeners\EmailLogger;

class InboxServiceProvider extends ServiceProvider
{
public function register()
{
$this->mergeConfigFrom(__DIR__ . '/../config/inbox.php', 'inbox');

$this->commands(InstallCommand::class);
}

public function boot()
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__ . '/../config/inbox.php' => config_path('inbox.php'),
]);
], 'laravel-inbox-config');

$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');

Expand Down

0 comments on commit cee2bed

Please sign in to comment.