Forum

Adldap2-Laravel - e...
 
Notifications
Clear all

Adldap2-Laravel - example listener

   RSS

0
Topic starter

example script, how to handle

1 Answer
0
Topic starter
  1. create file App\Listeners\LogSynchronized.php
  2. content of LogSynchronized.php
    <?php
    
    namespace App\Listeners;
    
    use Adldap\Laravel\Events\Synchronized;
    use Illuminate\Support\Facades\Log;
    
    class LogSynchronized
    {
        public function handle(Synchronized $event)
        {
            Log::info("Amazing User '{$event->user->getCommonName()}' has been successfully synchronized.");
        }
    }
    
  3. edit app/Providers/EventServiceProvider.php and modify $listen var
        protected $listen = array(
            Registered::class => array(
                SendEmailVerificationNotification::class,
            ),
            'Adldap\Laravel\Events\Synchronized' => [
                'App\Listeners\LogSynchronized',
            ],
        );
  4. run 
    php artisan adldap:import --restore --delete --no-interaction
  5. check logs (storage/logs/laravel.log)
  6. local.INFO: Amazing User 'nobody' has been successfully synchronized.

This post was modified 2 tygodnie temu by mrmucha

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: