I have a collection of $liquidAssets
and I want to loop through all of them and display only the $liquidAssets
which maches the key
, how could I do this? Do I need to firstly make a collection an array?
public function displayAssets()
{
$name = 'name';
$token = 'token';
$themeId = '123';
$assetAPI = new Asset($name, $token, $themeId);
$assets = $assetAPI->all();
$liquidAssets = collect($assets->assets)->where('content_type', 'text/x-liquid');
$liquidAssets = $liquidAssets->all();
foreach($liquidAssets as $asset) {
$response = $assetAPI->get($asset->key);
dd($response);
}
}
The logic is this:
- loop through all assets
- check if in array there is a key ld+json
- display all assets with ld+json
Now I get only the assets of a one asset
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire