25 lines
634 B
PHP
25 lines
634 B
PHP
<?php
|
|
|
|
namespace App\Repositories\CMS\Media\Banner;
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
class BannerRepository
|
|
{
|
|
/**
|
|
* Get nova resources
|
|
*/
|
|
public static function getNovaResource(string $resource): Collection|array
|
|
{
|
|
if (cache()->has("cs-nova-models-{$resource}")) {
|
|
return cache("cs-nova-models-{$resource}");
|
|
}
|
|
|
|
return cache()->remember(
|
|
key: "cs-nova-models-{$resource}",
|
|
ttl: 60,
|
|
callback: fn () => config("ecommerce.models.{$resource}")::pluck('name', 'id')->map(fn ($name, $id) => sprintf('%s - %s', $id, $name))
|
|
);
|
|
}
|
|
}
|