diff --git a/src/TenantManager.php b/src/TenantManager.php index b11a758b..dae6ce59 100644 --- a/src/TenantManager.php +++ b/src/TenantManager.php @@ -426,7 +426,7 @@ class TenantManager } /** - * Execute event listeners. + * Trigger an event and execute event listeners. * * @param string $name * @param mixed ...$args diff --git a/tests/TenantManagerTest.php b/tests/TenantManagerTest.php index f469972a..9506f9fd 100644 --- a/tests/TenantManagerTest.php +++ b/tests/TenantManagerTest.php @@ -320,4 +320,14 @@ class TenantManagerTest extends TestCase $this->expectException(TenantDoesNotExistException::class); tenancy()->find('gjnfdgf'); } + + /** @test */ + public function event_listeners_can_accept_arguments() + { + tenancy()->hook('tenant.creating', function ($tenantManager, $tenant) { + $this->assertSame('bar', $tenant->foo); + }); + + Tenant::new()->withData(['foo' => 'bar'])->save(); + } }