Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 9b67c01

Browse files
committed
Added Imported event to Import command
- Closes #461
1 parent c20d916 commit 9b67c01

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Commands/Console/Import.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
use Exception;
66
use Adldap\Models\User;
7+
use Adldap\Laravel\Events\Imported;
78
use Adldap\Laravel\Facades\Resolver;
89
use Adldap\Laravel\Commands\SyncPassword;
910
use Adldap\Laravel\Commands\Import as ImportUser;
1011
use Illuminate\Console\Command;
1112
use Illuminate\Support\Facades\Bus;
1213
use Illuminate\Support\Facades\Auth;
14+
use Illuminate\Support\Facades\Event;
1315
use Illuminate\Database\Eloquent\Model;
1416

1517
class Import extends Command
@@ -242,6 +244,8 @@ protected function save(User $user, Model $model) : bool
242244
if ($model->save() && $model->wasRecentlyCreated) {
243245
$imported = true;
244246

247+
Event::fire(new Imported($user, $model));
248+
245249
// Log the successful import.
246250
if ($this->isLogging()) {
247251
logger()->info("Imported user {$user->getCommonName()}");

0 commit comments

Comments
 (0)