Skip to content

Commit

Permalink
Add class based events.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Apr 2, 2020
1 parent 02de615 commit 7de1da6
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 4 deletions.
18 changes: 18 additions & 0 deletions src/Events/AuthorizationCreated.php
@@ -0,0 +1,18 @@
<?php

namespace Orchestra\Installation\Events;

use Orchestra\Contracts\Authorization\Authorization;

class AuthorizationCreated extends Event
{
/**
* Create a new event instance.
*
* @param \Orchestra\Contracts\Authorization\Authorization $acl
*/
public function __construct(Authorization $acl)
{
$this->acl = $acl;
}
}
8 changes: 8 additions & 0 deletions src/Events/Event.php
@@ -0,0 +1,8 @@
<?php

namespace Orchestra\Installation\Events;

abstract class Event
{
//
}
2 changes: 1 addition & 1 deletion src/Events/InstallationCompleted.php
Expand Up @@ -2,7 +2,7 @@

namespace Orchestra\Installation\Events;

class InstallationCompleted
class InstallationCompleted extends Event
{
/**
* Form input.
Expand Down
8 changes: 8 additions & 0 deletions src/Events/SchemaCreated.php
@@ -0,0 +1,8 @@
<?php

namespace Orchestra\Installation\Events;

class SchemaCreated extends Event
{
//
}
3 changes: 3 additions & 0 deletions src/Installation.php
Expand Up @@ -9,6 +9,7 @@
use Orchestra\Contracts\Memory\Provider;
use Orchestra\Foundation\Auth\User;
use Orchestra\Foundation\Jobs\UpdateMailConfiguration;
use Orchestra\Installation\Events\SchemaCreated;
use Orchestra\Model\Role;

class Installation implements InstallationContract
Expand All @@ -30,6 +31,8 @@ class Installation implements InstallationContract
public function migrate(): bool
{
\app('orchestra.publisher.migrate')->foundation();

\event(new SchemaCreated());
\event('orchestra.install.schema');

return true;
Expand Down
6 changes: 3 additions & 3 deletions src/Listeners/MigrateDatabaseSchema.php
Expand Up @@ -3,18 +3,18 @@
namespace Orchestra\Installation\Listeners;

use Illuminate\Support\Facades\Artisan;
use Orchestra\Installation\Events\InstallationCompleted;
use Orchestra\Installation\Events\Event;

class MigrateDatabaseSchema
{
/**
* Handle the event.
*
* @param \Orchestra\Installation\Events\InstallationCompleted $event
* @param \Orchestra\Installation\Events\Event $event
*
* @return void
*/
public function handle(InstallationCompleted $event)
public function handle(Event $event)
{
Artisan::call('migrate', ['--force' => true]);
}
Expand Down

0 comments on commit 7de1da6

Please sign in to comment.