Get if event is allowed to create notification or not.

@return bool
760720
public function isAllowedToNotify()
    {
        if (!$this->changeSet || !isset($this->changeSet['mask'])) {
            return false;
        }
        if ('ROLE_ANONYMOUS' === $this->role->getName() || 'ROLE_USER' === $this->role->getName()) {
            return false;
        }

        $oldState = $this->changeSet['mask'][0];
        $newState = $this->changeSet['mask'][1];

        return 0 === $oldState % 2 && 1 === $newState % 2;
    }
203482
protected function handleNotifications()
    {
        if (($this->exitcode > 0) && $this->scheduler->alert_on_fail) {
            return app(Eye::class)->notifier()->alert(new Error(['scheduler' => $this->scheduler,
                                                                 'exitcode' => $this->exitcode]));
        }

        if (($this->scheduler->alert_run_time_greater_than > 0) && ($this->history->time_to_run > $this->scheduler->alert_run_time_greater_than)) {
            return app(Eye::class)->notifier()->alert(new Slow(['scheduler' => $this->scheduler,
                                                                'time_to_run' => $this->history->time_to_run]));
        }

        if (($this->scheduler->alert_run_time_less_than > 0) && ($this->history->time_to_run < $this->scheduler->alert_run_time_less_than)) {
            return app(Eye::class)->notifier()->alert(new Fast(['scheduler' => $this->scheduler,
                                                                'time_to_run' => $this->history->time_to_run]));
        }

        if (! $this->scheduler->healthy) {
            if (! is_null($this->scheduler->healthy)) {
                app(Eye::class)->notifier()->alert(new Working(['scheduler' => $this->scheduler]));
            }

            $this->scheduler->healthy = true;
            $this->scheduler->save();
        }
    }
1209030
public function copyEventsAndNotifications()
    {
        // copy EVENTS
        $this->copyFilesFromSource($this->appPath . 'Events', app_path('Events'));

        // copy LISTENERS
        $this->copyFilesFromSource($this->appPath . 'Listeners', app_path('Listeners'));

        // copy Mail
        $this->copyFilesFromSource($this->appPath . 'Mail', app_path('Mail'));

        // copy Notifications
        $this->copyFilesFromSource($this->appPath . 'Events', app_path('Notifications'));

        // copy EventServiceProvider
        $source = $this->appPath . "Providers{$this->ds}EventServiceProvider.php";
        $this->copyFilesFromSource($source, app_path('Providers'));
    }
600024
public function notify(NotificationInterface $notification, $level = self::INFO)
    {
        if (!$this->handlers)
        {
            $this->addHandler(new NullHandler());
        }

        foreach ($this->getHandlers() as $handler)
        {
            if ($handler->shouldHandle($notification, $level))
            {
                if (false === $handler->handle($notification, $level))
                {
                    return false;
                }
            }
        }

        return true;
    }
235269
public function hasEnabledInvitationRegistration()
    {
        if ($this->invitationRegistrationClass === false || !is_string($this->invitationRegistrationClass) || !class_exists($this->invitationRegistrationClass)) {
            return false;
        }
        return true;
    }
589220
public function valid()
    {
        if ($this->counter > Settings::$maxRecurrences && -1 !== Settings::$maxRecurrences) {
            throw new MaxInstancesExceededException('Recurring events are only allowed to generate '.Settings::$maxRecurrences);
        }

        return (bool) $this->currentDate;
    }
853429
public function getNotification()
    {
        $data = pg_get_notify($this->handler, \PGSQL_ASSOC);

        return $data === false ? null : $data;
    }
344564
protected function CanCreate()
    {
        return self::Guard()->Allow(BackendAction::Create(), new Container())
            && self::Guard()->Allow(BackendAction::UseIt(), new ContainerForm());
    }
845994
protected function fireEvent($event, $message)
    {
        if (!isset($this->notification)) {
            return true;
        }

        return $this->getNotification()->fire($event, $this, $message);
    }
1021790
protected function fires()
    {
        $className = isset($this->notification->classname) ? snake_case(class_basename($this->notification->classname)) : false;

        if (! $className) {
            return [];
        }

        $before = event('notifications:' . $className . '.render.before');
        $after  = event('notifications:' . $className . '.render.after');

        return [
            'before' => !empty($before) ? current($before) : '',
            'after'  => !empty($after) ? current($after) : ''
        ];
    }
144120
public function readNotifyHeap(): self
    {
        foreach ($this->notifyHeap as $notifyIndex => $notifyDatas) {
            $this->action  = $notifyDatas->action;
            $this->context = $notifyDatas->context;
            
            $this->notify();
            
            //Remove the current notification from list
            unset($this->notifyHeap[$notifyIndex]);
        }
        
        //Some new notifications has been added during the loop
        if (count($this->notifyHeap) > 0) {
            $this->readNotifyHeap();
        }

        return $this;
    }
541080
public function beforeUnlock () {
        $event = new ModelEvent;
        $event->sender = $this;
        $this->onBeforeUnlock ($event);
        return $event->isValid;
    }
1138912
function canCreate( )
    {
        if ( !isset( $this->Permissions["can_create"] ) )
        {
            $this->Permissions["can_create"] = $this->checkAccess( 'create' );
        }
        return ( $this->Permissions["can_create"] == 1 );
    }
780275
function isBannable() {
        if($this->id === $this->guild->ownerID || $this->id === $this->client->user->id) {
            return false;
        }
        
        $member = $this->guild->me;
        if(!$member->permissions->has(\CharlotteDunois\Yasmin\Models\Permissions::PERMISSIONS['BAN_MEMBERS'])) {
            return false;
        }
        
        return ($member->getHighestRole()->comparePositionTo($this->getHighestRole()) > 0);
    }
607199
public function hasMatchingEvent()
    {
        // Retrieve the 'event' part of the payload
        $eventData = $this->payload->get('event');

        // If the event type isn't 'message' (which should go through BotMan::hears),
        // build a GenericEvent and return it
        if (isset($eventData['type']) && $eventData['type'] !== 'message') {
            $eventPayload = json_encode($eventData);
            if ($eventPayload !== false) {
                $event = new GenericEvent($eventPayload);
                $event->setName($eventData['type']);

                return $event;
            }
        }

        // Otherwise, fall back to the parent implementation
        return parent::hasMatchingEvent();
    }
1349194
public function makeNotification()
    {
        $this->options['name'] = $this->ask('Notification Name (Example: MyNotification)');

        if ($this->confirm('Would you like to create a template for this notification command?')) {
            $this->options['--markdown'] = strtolower($this->options['name']);
        }
    }
673448
public static function setup_notifications() {
		$notifications       = apply_filters( 'themeisle_sdk_registered_notifications', [] );
		$notifications       = array_filter(
			$notifications,
			function ( $value ) {
				if ( ! isset( $value['id'] ) ) {
					return false;
				}
				if ( get_option( $value['id'], '' ) !== '' ) {
					return false;
				}

				return apply_filters( $value['id'] . '_should_show', true );
			}
		);
		self::$notifications = $notifications;
	}