file-management-system/app/Actions/GetThemeType.php
Daeng Deni Mardaeni c73ea1b54c update metronic 8.2
2023-09-26 16:51:59 +07:00

25 lines
467 B
PHP

<?php
namespace App\Actions;
class GetThemeType
{
public array $types = ['primary', 'success', 'info', 'danger', 'warning'];
public int $seed;
public function handle($format = '?', $seed = '')
{
$this->seed = crc32($seed);
return str_replace('?', $this->randomType(), $format);
}
public function randomType()
{
srand($this->seed);
return $this->types[rand(0, count($this->types) - 1)] ?? '';
}
}