ldc-legaulois/app/Http/Requests/StoreActuRequest.php
2021-09-20 19:13:28 +02:00

43 lines
1.2 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;
class StoreActuRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$this->merge([
'status' => $this->status ? true : false,
'slug' => Str::slug($this->title),
]);
return auth()->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'title' => 'required|string|min:20|max:255',
'slug' => 'required|unique:actus,slug|max:255',
'seo_title' => 'required|string|min:20|max:255',
'seo_description' => 'required|string|min:20|max:255',
'picture' => 'required|image|mimes:png,jpg,jpeg|dimensions:height=611,width=916',
'picture_alt' => 'required|string|min:5|max:255',
'header' => 'required|string',
'content' => 'required|string|min:20',
'status' => 'required|boolean',
];
}
}