ldc-supportweb/app/Http/Requests/StoreSite.php
2021-07-23 11:43:47 +02:00

33 lines
641 B
PHP

<?php
namespace App\Http\Requests;
use App\Enums\Role;
use Illuminate\Foundation\Http\FormRequest;
class StoreSite extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
/** @var \App\Models\User */
$user = auth()->user();
return auth()->check() and $user->isAdmin();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|string|min:4|max:30'
];
}
}