Open
Description
Extension Version
1.0.0
PHP Binary
Other
Operating System
Linux
What happened?
This line throws a warning of Translation [validation.attributes.question] not found.
when question
is an array of attributes.
__('validation.attributes.question');
I'm using this feature in request classes and overwite public function attributes(){}
to merge attribute names with an array of attributes.
For example I create an array in validation file under attributes
index named question
and question
contains list of attributes
for question
model.
Mimimal Code Sample
<?php
namespace App\Http\Requests\BaseData\App;
use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
class QuestionRequest 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 [];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes()
{
return __('validation.attributes.question');
}
}