Answer the question
In order to leave comments, you need to log in
Laravel is it possible to somehow pull out a variable?
How to pull the min variable in layout?
class MyformRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
return [
'email'=>'required|min:6',
'password'=>'required|min:6',
];
}
public function messages()
{
return [
'email.required' => 'Поле Email не должно быть пустым',
'email.min' => 'Поле Email должно содержать не менее :min символов',
'password.required' => 'Пароль не введен',
'password.min' => 'Поле Password содержит менее :min символов',
];
}
}
<input type="password" name="password" class="form-control" id="password"
placeholder="Enter password">
<small id="emailHelp" class="form-text text-muted">*не менее 6 символов.</small>
<input type="password" name="password" class="form-control" id="password"
placeholder="Enter password">
<small id="emailHelp" class="form-text text-muted">*не менее {{':min'}} символов.</small>
Answer the question
In order to leave comments, you need to log in
function __construct() {
$min = 6
}
public function rules()
{
return [
'email'=>'required|min:$min',
'password'=>'required|min:$min',
];
}
return view('layout', compact('min'))
<input type="password" name="password" class="form-control" id="password"
placeholder="Enter password">
<small id="emailHelp" class="form-text text-muted">*не менее {{$min}} символов.</small>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question