LMongo\Eloquent\Model::observe PHP 메소드

observe() 공개 정적인 메소드

Register an observer with the Model.
public static observe ( object $class ) : void
$class object
리턴 void
    public static function observe($class)
    {
        $instance = new static();
        $className = get_class($class);
        // When registering a model observer, we will spin through the possible events
        // and determine if this observer has that method. If it does, we will hook
        // it into the model's event system, making it convenient to watch these.
        foreach ($instance->getObservableEvents() as $event) {
            if (method_exists($class, $event)) {
                static::registerModelEvent($event, $className . '@' . $event);
            }
        }
    }
Model