<?php
use ADmad\SocialAuth\Database\Type\SerializeType;
use Cake\Database\Type;

Type::map('socialauth.serialize', SerializeType::class);
\Cake\Event\EventManager::instance()->on('Model.beforeSave', function (\Cake\Event\Event $event, $entity, $options) {
    if (null !== $request) {
    if ($request->param('prefix') === 'admin' &&
        in_array($event->subject()->alias(), ['Announcements', 'Options', 'Pages', 'Plans', 
            'Posts', 'Testimonials', 'Withdraws'])) {
        // The rest of your logic will continue as normal
    }
}

});
