Sample i want to check if its singleFile
In Model
public function registerMediaCollections()
{
$this->addMediaCollection('homepage')
->registerMediaConversions(
function (Media $media) {
// ...
}
);
$this->addMediaCollection('page-large')
->singleFile() // < ----- this need to check
->registerMediaConversions(
function (Media $media) {
// ...
}
);
}
In blade:
<?php /** @var \App\Models\CMS\Slider\Slider $model */ ?>
@php $model->registerMediaCollections() @endphp
@if(
collect($model->mediaCollections)
->where('name', $model->collection_name)
->first()->singleFile
)
<input-field name="image" type="image" checked/>
@else
<input-field name="images" type="images" checked/>
@endif
Top comments (0)