Files
wticreatorstudio/Modules/Chat/Http/Requests/API/CreateGroupRequest.php
T
2024-02-12 22:54:20 -05:00

45 lines
960 B
PHP

<?php
namespace Modules\Chat\Http\Requests\API;
use Modules\Chat\Entities\Group;
use Illuminate\Foundation\Http\FormRequest;
class CreateGroupRequest 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()
{
return Group::$rules;
}
public function sanitize()
{
$input = $this->all();
$input['name'] = isset($input['name']) ? htmlspecialchars($input['name']) : '';
$input['description'] = isset($input['description']) ? htmlspecialchars($input['description']) : '';
$this->replace($input);
}
}