simedkom/app/Http/Requests/SettingRequest.php
2025-02-27 15:18:33 +07:00

39 lines
1.2 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
class SettingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return Auth::check() && is_role(['1']);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'app_name' => ['required', 'string', 'max:255'],
'app_title' => ['required', 'string', 'max:255'],
'app_description' => ['required', 'string'],
'app_keywords' => ['required'],
'app_icon' => ['nullable', 'file', 'mimes:png,jpg,jpeg', 'max:4096'],
'app_logo' => ['nullable', 'file', 'mimes:png,jpg,jpeg', 'max:4096'],
'contact_address' => ['nullable'],
'contact_phone' => ['nullable', 'regex:/^[0-9+\s-]+$/'],
'contact_email' => ['nullable', 'email', 'max:255'],
'about_us' => ['required', 'string'],
];
}
}