47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\System\Setting;
|
|
|
|
use App\Enums\Permission;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class SystemRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()?->can(Permission::SETTINGS_UPDATE->value) ?? false;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'app_name' => ['required', 'string', 'max:100'],
|
|
'about_app' => ['required', 'string'],
|
|
'email' => ['required', 'email', 'max:100'],
|
|
'phone' => ['required', 'string', 'max:20'],
|
|
'address' => ['required', 'string'],
|
|
'logo' => ['required', 'image', 'max:2048'],
|
|
'login_cover' => ['required', 'image', 'max:5120'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'app_name' => 'nama aplikasi',
|
|
'about_app' => 'tentang aplikasi',
|
|
'email' => 'email',
|
|
'phone' => 'nomor telepon',
|
|
'address' => 'alamat',
|
|
'logo' => 'logo',
|
|
'login_cover' => 'cover login',
|
|
];
|
|
}
|
|
}
|