2023-06-11 12:14:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Themes\Storefront;
|
|
|
|
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
class Feature
|
|
|
|
{
|
|
|
|
public $icon;
|
|
|
|
public $title;
|
|
|
|
public $subtitle;
|
|
|
|
|
2023-12-03 14:07:47 +00:00
|
|
|
|
2023-06-11 12:14:03 +00:00
|
|
|
public function __construct($icon, $title, $subtitle)
|
|
|
|
{
|
|
|
|
$this->icon = $icon;
|
|
|
|
$this->title = $title;
|
|
|
|
$this->subtitle = $subtitle;
|
|
|
|
}
|
|
|
|
|
2023-12-03 14:07:47 +00:00
|
|
|
|
2023-06-11 12:14:03 +00:00
|
|
|
public static function all()
|
|
|
|
{
|
2023-12-03 14:07:47 +00:00
|
|
|
if (!setting('storefront_features_section_enabled')) {
|
2023-06-11 12:14:03 +00:00
|
|
|
return collect();
|
|
|
|
}
|
|
|
|
|
|
|
|
return Collection::times(5, function ($number) {
|
|
|
|
return self::getFeatureFor($number);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-12-03 14:07:47 +00:00
|
|
|
|
2023-06-11 12:14:03 +00:00
|
|
|
private static function getFeatureFor($number)
|
|
|
|
{
|
|
|
|
return new self(
|
|
|
|
setting("storefront_feature_{$number}_icon"),
|
|
|
|
setting("storefront_feature_{$number}_title"),
|
|
|
|
setting("storefront_feature_{$number}_subtitle")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|