for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Sco\Admin\Http\Requests;
use Illuminate\Validation\Rule;
class UpdateRoleRequest extends BaseFormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
return true;
}
* Get the validation rules that apply to the request.
* @return array
public function rules()
return [
'id' => 'integer',
'name' => [
'bail',
'required',
'regex:/^[a-z0-9]+$/i',
'max: 50',
Rule::unique(config('admin.roles_table'))->ignore($this->input('id')),
],
'display_name' => [
'alpha_num',
'description' => [
];
protected function getMessages()
'max' => trans('admin::validation.max.string'),
'regex' => '字母数字',
protected function getAttributes()
'name' => '标识',