Blog User Guide Documentation API Login Register

Documentation > Reference

Matrix Helpers

Last updated February 16, 2024

Available Methods

Method Listing

matrix_exists()

The matrix_exists method will return a boolean value based on if the given matrix collection exists or not.

if (matrix_exists('blog')) {
    // The matrix collection "blog" exists
}

matrix_collections()

The matrix_collections method returns an instance of the matrix collection model.

foreach (matrix_collections()->get() as $collection) {
    //
}

matrix_entries()

The matrix_entries method returns an instance of the matrix entry model for the given matrix collection handle.

$posts = matrix_entries('blog');

You may also pass through a second parameter to limit the entries from a specific type associated with the collection.

$articles = matrix_entries('support', 'faq');

matrix_collection()

The matrix_collection method returns an instance of the matrix collection model for the given handle.

$blog = matrix_collection('blog');

matrix_type()

The matrix_type method returns an instance of the matrix type model for the given collection and type handle.

$faq = matrix_collection('support', 'faq');

matrix_builder()

The matrix_builder method returns an instance of the matrix builder using the passed collection and type handles.

$builder = matrix_builder('blog', 'posts');

matrix_make()

The matrix_make method returns an instance of the matrix entry model using the passed collection and type handles.

$model = matrix_make('blog', 'posts');