Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

For a software dev like me who has no idea how to create a cute hand-drawn dashed line, this course just 100% works.

— Ira Zayats, Developer

Asset Container Repository

To work with the with AssetContainer Repository, use the following Facade:

use Statamic\Facades\AssetContainer;


Methods Description
all() Get all AssetContainers
find($id) Get AssetContainer by id
findByHandle($handle) Get AssetContainer by handle
findOrFail($id) Get AssetContainer by id. Throws an AssetContainerNotFoundException when the asset container cannot be found.
queryAssets() Query Builder for the AssetContainer's Assets
make() Makes a new AssetContainer instance
Hot Tip!

The id is the same as handle while using the default Stache driver.


While the AssetContainer Repository does not have a Query Builder, you can still query for Assets inside AssetContainers with the queryAssets method. This approach can be useful for retrieving Assets with an existing AssetContainer object.

$videos = AssetContainer::find('videos');
->where('series', 'stranger-things')

When an asset container can't be found, the AssetContainer::find() method will return null. If you'd prefer an exception be thrown, you may use the findOrFail method:



Start by making an instance of an asset container with the make method. You can pass the handle into it.

$container = AssetContainer::make('assets');

You may call additional methods on the container to customize it further.


Finally, save it.

HR: Section
Learn More!

There is more to learn more in these related articles:





HR: Section
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →