src/Laravel/Model/ExtTrait.php
private static function registerObserve()
    {
        $className        = 'Observer\\'.get_called_class();
        $observableEvents = [
            'creating', 'created', 'updating', 'updated',
            'deleting', 'deleted', 'saving', 'saved',
            'restoring', 'restored',
        ];

        if (class_exists($className)) {
            $priority = 0;
            foreach ($observableEvents as $event) {
                if (method_exists($className, $event)) {
                    static::registerModelEvent($event, $className.'@'.$event, $priority);
                }
            }
        }
    }
private static function registerObserve()
    {
        $className        = 'Observer\\'.get_called_class();
        $observableEvents = [
            'creating', 'created', 'updating', 'updated',
            'deleting', 'deleted', 'saving', 'saved',
            'restoring', 'restored',
        ];

        if (class_exists($className)) {
            $priority = 0;
            foreach ($observableEvents as $event) {
                if (method_exists($className, $event)) {
                    static::registerModelEvent($event, $className.'@'.$event, $priority);
                }
            }
        }
    }
private static function registerObserve ( ) { $ className = 'Observer\\' . get_called_class ( ) ; $ observableEvents = [ 'creating' , 'created' , 'updating' , 'updated' , 'deleting' , 'deleted' , 'saving' , 'saved' , 'restoring' , 'restored' , ] ; if ( class_exists ( $ className ) ) { $ priority = 0 ; foreach ( $ observableEvents as $ event ) { if ( method_exists ( $ className , $ event ) ) { static :: registerModelEvent ( $ event , $ className . '@' . $ event , $ priority ) ; } } } }
注册 Observer 命名空间下，与当前模型同名的模型观察者

@return void
注册 Observer 命名空间下，与当前模型同名的模型观察者