43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\System\Setting;
|
|
|
|
use App\Enums\Permission;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class HomepageSettingRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()?->can(Permission::SETTINGS_UPDATE->value) ?? false;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'hero_image' => ['nullable', 'image', 'max:5120'],
|
|
'about_image' => ['nullable', 'image', 'max:5120'],
|
|
'gallery_images' => ['nullable', 'array', 'max:10'],
|
|
'gallery_images.*' => ['image', 'max:5120'],
|
|
'gallery_images_remove' => ['nullable', 'array'],
|
|
'gallery_images_remove.*' => ['integer'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'hero_image' => 'Foto Hero',
|
|
'about_image' => 'Foto Tentang Kami',
|
|
'gallery_images' => 'Foto Lookbook',
|
|
'gallery_images.*' => 'Foto Lookbook',
|
|
];
|
|
}
|
|
}
|