mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-15 11:07:53 -04:00
48 lines
943 B
PHP
48 lines
943 B
PHP
<?php
|
|
|
|
namespace Modules\Chat\Http\Requests;
|
|
|
|
use Modules\Chat\Entities\Role;
|
|
use function GuzzleHttp\Psr7\str;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CreateRoleRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
protected function prepareForValidation()
|
|
{
|
|
$this->sanitize();
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
$rules = Role::$rules;
|
|
$rules['name'] = 'required|string|max:100|unique:roles';
|
|
|
|
return $rules;
|
|
}
|
|
|
|
public function sanitize()
|
|
{
|
|
$input = $this->all();
|
|
|
|
$input['name'] = htmlspecialchars($input['name']);
|
|
|
|
$this->replace($input);
|
|
}
|
|
}
|