UserFormRequest.php
<?php
namespace App'Http'Requests;
use App'Http'Requests'Request;
class UserForm extends Request
{
/**
* 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 [
'firstname' => 'required|max:50|alpha',
'per_address' => 'required',//permanent address
'temp_address' => 'required',//temporary address
'occupation' => 'required',
'gender' => 'required',
'email' => 'required|email|min:6|max:200|unique:users',
'phone' => 'required|numeric|digits_between:8,25',
'bloodgroup' => 'required',
'date' => 'required',
];
}
}
尝试函数ucwords和ucfirst,请记住,您需要首先使用转换为小写文本
ucwords(strtolower($text))
注意:mb_strtlower用于多字节编码,如UTF8。
http://php.net/manual/en/function.ucwords.php
http://php.net/manual/en/function.ucfirst.php
http://php.net/manual/en/function.strtolower.php
http://php.net/manual/en/function.mb-strtolower.php