mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 20:43:56 +00:00
30ed77f304
# Conflicts: # resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue # routes/api.php
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CreateAffiliateRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
// Authorization will be handled by middleware and policy
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'code' => [
|
|
'nullable',
|
|
'string',
|
|
'min:3',
|
|
'max:255',
|
|
'regex:/^[a-zA-Z0-9_-]+$/',
|
|
],
|
|
'campaign_name' => 'required|string|max:255',
|
|
'campaign_description' => 'nullable|string|max:65535',
|
|
'is_active' => 'nullable|boolean',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom error messages for validation rules.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function messages()
|
|
{
|
|
return [
|
|
'code.regex' => 'The affiliate code may only contain letters, numbers, hyphens, and underscores.',
|
|
'code.unique' => 'This affiliate code is already in use.',
|
|
'code.min' => 'The affiliate code must be at least 3 characters.',
|
|
'campaign_name.required' => 'A campaign name is required.',
|
|
'campaign_name.max' => 'The campaign name cannot exceed 255 characters.',
|
|
];
|
|
}
|
|
}
|
|
|
|
|