42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Tenant;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class DataExportStoreRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'scope' => ['required', Rule::in(['tenant', 'event'])],
|
|
'event_id' => ['required_if:scope,event', 'integer', 'exists:events,id'],
|
|
'include_media' => ['nullable', 'boolean'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'scope.required' => 'Export scope is required.',
|
|
'scope.in' => 'Export scope must be tenant or event.',
|
|
'event_id.required_if' => 'Event export requires an event.',
|
|
'event_id.exists' => 'Selected event could not be found.',
|
|
];
|
|
}
|
|
}
|