wip
This commit is contained in:
40
app/Repositories/CMS/Icon/IconRepository.php
Normal file
40
app/Repositories/CMS/Icon/IconRepository.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\CMS\Icon;
|
||||
|
||||
use Laravel\Nova\Makeable;
|
||||
|
||||
class IconRepository
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
/**
|
||||
* Upload icon
|
||||
*/
|
||||
public function upload(): string
|
||||
{
|
||||
return '<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" />
|
||||
</svg>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Download document
|
||||
*/
|
||||
public function documentDownload()
|
||||
{
|
||||
return '<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Document report
|
||||
*/
|
||||
public function documentReport()
|
||||
{
|
||||
return '<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>';
|
||||
}
|
||||
}
|
||||
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