wip
This commit is contained in:
24
app/Repositories/CMS/Media/Banner/BannerRepository.php
Normal file
24
app/Repositories/CMS/Media/Banner/BannerRepository.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user