public function rules()
{
return [
'pagetitle' => 'required|string|min:5|max:255|unique:categories,pagetitle',
'alias' => 'required|string|min:2|max:255|unique:categories,alias',
];
}
protected function prepareForValidation()
{
if($this->alias == null)
{
$this->merge([
'alias' => Str::slug($this->pagetitle),
]);
}
else
{
$this->merge([
'alias' => Str::slug($this->alias),
]);
}
}
public function withValidator($validator)
{
$validator->after(function ($validator) {
request()->merge([
'alias' => $this->request->get('alias')
]);
// $validator->errors()->add('alias', 'Something is wrong with this field!');
});
}
dd($request);
node_modules .git .idea server.php
необязательно.return Storage::download('file.jpg');
return Storage::download('file.jpg', $name, $headers);
/lang/ru/validation.php
return [
'attributes' => [
'email' => 'Email',
'name' => 'Имя',
'password' => 'Пароль',
]
];
$table->foreignId('category_id')
->constrained()
->onUpdate('cascade')
->onDelete('cascade');