public static function find($id, $language_id, $revision_id = null)
    {
        $instance = new static($language_id);

        try {
            $instance->content = Content::findOrFail($id);
        } catch (ModelNotFoundException $e) {
            throw new EntityNotFoundException("The entity with id '$id' doesn't exist", 0, $e);
        }

        $instance->revision = static::findRevision($id, $language_id, $revision_id);

        $instance->getFieldTypes()
            ->each(function ($type) use ($instance) {
                $type::where('revision_id', $instance->revision->id)
                    ->get()
                    ->each(function (Field $value) use ($instance) {
                        $instance->data[$value->name][$value->weight] = $value;
                    });
            });

        return $instance;
    }
public static function find($id, $language_id, $revision_id = null)
    {
        $instance = new static($language_id);

        try {
            $instance->content = Content::findOrFail($id);
        } catch (ModelNotFoundException $e) {
            throw new EntityNotFoundException("The entity with id '$id' doesn't exist", 0, $e);
        }

        $instance->revision = static::findRevision($id, $language_id, $revision_id);

        $instance->getFieldTypes()
            ->each(function ($type) use ($instance) {
                $type::where('revision_id', $instance->revision->id)
                    ->get()
                    ->each(function (Field $value) use ($instance) {
                        $instance->data[$value->name][$value->weight] = $value;
                    });
            });

        return $instance;
    }
public static function find ( $ id , $ language_id , $ revision_id = null ) { $ instance = new static ( $ language_id ) ; try { $ instance -> content = Content :: findOrFail ( $ id ) ; } catch ( ModelNotFoundException $ e ) { throw new EntityNotFoundException ( "The entity with id '$id' doesn't exist" , 0 , $ e ) ; } $ instance -> revision = static :: findRevision ( $ id , $ language_id , $ revision_id ) ; $ instance -> getFieldTypes ( ) -> each ( function ( $ type ) use ( $ instance ) { $ type :: where ( 'revision_id' , $ instance -> revision -> id ) -> get ( ) -> each ( function ( Field $ value ) use ( $ instance ) { $ instance -> data [ $ value -> name ] [ $ value -> weight ] = $ value ; } ) ; } ) ; return $ instance ; }
Find the latest valid revision for this entity

@param int $id The content ID
@param int $language_id The language ID
@param int $revision_id The revision ID which you want to load, this is optional
@throws EntityNotFoundException
@throws NoPublishedRevisionForLanguageException
@throws NoRevisionForLanguageException
@throws RevisionEntityMismatchException
@throws RevisionNotFoundException
@return static
Find the latest valid revision for this entity