本文整理汇总了PHP中App\Http\Requests\Request::input方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::input方法的具体用法?PHP Request::input怎么用?PHP Request::input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Requests\Request
的用法示例。
在下文中一共展示了Request::input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeOrUpdate
public function storeOrUpdate(Request $request, $id = null)
{
$user = $id ? $this->getById($id) : new User();
$user->name = $request->input('name');
$user->email = $request->input('email');
$user->password = Hash::make($request->input('password'));
$user->status = UserStatus::ACTIVATED();
$user->save();
return $user;
}
示例2: storeOrUpdate
/**
* If a post exists, update its properties. If not then create new
*
* @param Request $request
* @param string $id
* @return \Illuminate\Database\Eloquent\Model
*/
public function storeOrUpdate(Request $request, $id = null)
{
$post = $id ? $this->getById($id) : new Post();
$post->user_id = Auth::id();
$post->title = $request->input('title');
$post->body = $request->input('body');
$post->excerpt = $request->input('excerpt');
$post->uri = str_slug($request->input('title'));
$post->status = PostStatus::PUBLISHED();
$post->save();
return $post;
}
示例3: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (Request::input('cat')[0] == 3 or Request::input('cat')[0] == '') {
return ['cat.0' => 'required', 'published_at' => 'required', 'title' => 'required|min:3|max:255', 'body' => 'required'];
} else {
return ['cat.0' => 'required', 'published_at' => 'required', 'title' => 'required|min:3|max:255', 'body' => 'required', 'director' => 'required|min:3|max:50', 'actor' => 'required|min:3|max:100'];
}
}
示例4: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$role = Auth::user()->role->id;
if ($role == 1) {
return true;
} elseif ($role == 4 || $role == 3) {
$uer_company_id = Auth::user()->company_id;
$company_id = Request::input('company_id');
return $uer_company_id == $company_id;
}
return false;
}
示例5: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$isLoggedIn = false;
if (Auth::check()) {
$isLoggedIn = true;
}
if (Request::input('ArticleUserId')) {
if (Request::input('ArticleUserId') != Auth::User()->id) {
$isLoggedIn = false;
}
}
return $isLoggedIn;
}
示例6: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [];
$rules['question.text'] = 'required|min:5';
$rules['image'] = 'mime:jpeg,png,gif,bmp,tif|max:4096';
// TODO
$rules['question.type'] = 'required';
$rules['answers'] = 'required';
foreach (Request::input('answers') as $key => $item) {
$rules['answers.' . $key . '.text'] = 'required';
$rules['answers.' . $key . '.image'] = 'mime:jpeg,png,gif,bmp,tif|max:4096"';
// TODO
}
// TODO экспорт в XML. Пересмотреть вид простомотра результата теста
return $rules;
}
示例7: rules
public function rules()
{
$method = $this->method();
$route = \Route::getCurrentRoute()->getPath();
switch ($method) {
case 'GET':
case 'DELETE':
return [];
case 'POST':
// if($route == 'api/auth/login')
// {
// return [
// 'email' => 'required',
// 'password' => 'required',
// ];
// }
// else if($route == 'api/auth/forgot')
// {
// return [
// 'email' => 'required',
// ];
// }
// else if($route == 'api/system_users/image')
// {
// return [
// 'user_image_upload' => 'required|image',
// ];
// }
// else if($route == 'api/auth/password')
// {
// return [
// 'old_password' => 'required',
// 'new_password' => 'required',
// 'confirm_password' => 'required',
// ];
// }
// else
// {
return ['language' => 'required|unique:language', 'code' => 'required'];
//}
case 'PUT':
return ['language' => 'unique:language,language,' . \Request::input('id'), 'code' => 'required'];
case 'PATCH':
default:
break;
}
}
示例8: rules
public function rules()
{
$method = $this->method();
$route = \Route::getCurrentRoute()->getPath();
switch ($method) {
case 'GET':
case 'DELETE':
return [];
case 'POST':
return ['distance_from' => 'required', 'distance_to' => 'required', 'radius' => 'required'];
case 'PUT':
return ['distance_from' => 'required' . \Request::input('radius_id'), 'distance_from' => 'required', 'radius' => 'required'];
case 'PATCH':
default:
break;
}
}
示例9: rules
public function rules()
{
$method = $this->method();
$route = \Route::getCurrentRoute()->getPath();
switch ($method) {
case 'GET':
case 'DELETE':
return [];
case 'POST':
return ['make' => 'required|unique:car_make'];
case 'PUT':
return ['email' => 'unique:car_make,make,' . \Request::input('make_id')];
case 'PATCH':
default:
break;
}
}
示例10: rules
public function rules()
{
$method = $this->method();
$route = \Route::getCurrentRoute()->getPath();
switch ($method) {
case 'GET':
case 'DELETE':
return [];
case 'POST':
return ['template_name' => 'required|unique:email_templates', 'subject' => 'required', 'template' => 'required', 'status' => 'required'];
//}
case 'PUT':
return ['template_name' => 'unique:email_templates,template_name,' . \Request::input('id'), 'subject' => 'required', 'template' => 'required', 'status' => 'required'];
case 'PATCH':
default:
break;
}
}
示例11: rules
public function rules()
{
$method = $this->method();
$route = \Route::getCurrentRoute()->getPath();
switch ($method) {
case 'GET':
case 'DELETE':
return [];
case 'POST':
if ($route == 'api/vehicle_type/image') {
return ['vehicle_type_image_upload' => 'required|image'];
} else {
return ['vehicle_type' => 'required|unique:vehicle_types', 'pic_path' => 'required', 'category_id' => 'required', 'status' => 'required'];
}
case 'PUT':
return ['vehicle_type' => 'unique:vehicle_types,vehicle_type,' . \Request::input('id'), 'pic_path' => 'required', 'category_id' => 'required', 'status' => 'required'];
case 'PATCH':
default:
break;
}
}
示例12: rules
public function rules()
{
$method = $this->method();
$route = \Route::getCurrentRoute()->getPath();
switch ($method) {
case 'GET':
case 'DELETE':
return [];
case 'POST':
if ($route == 'api/users/image') {
return ['user_image_upload' => 'required|image'];
} else {
return ['first_name' => 'required', 'last_name' => 'required', 'mobile' => 'required', 'email' => 'required|unique:site_users', 'password' => 'required'];
}
case 'PUT':
return ['first_name' => 'required', 'last_name' => 'required', 'mobile' => 'required', 'email' => 'unique:site_users,email,' . \Request::input('user_id')];
case 'PATCH':
default:
break;
}
}
示例13: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return ['category_id' => 'required|exists:categories,id', 'name' => 'required|max:255|unique:products,name,' . Request::input('id'), 'description' => 'max:255', 'quantity' => 'required|digits_between:1,1000', 'available' => 'boolean', 'active' => 'boolean', 'price' => 'required|numeric|between:1,1000000000'];
}
示例14: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return ['nama_project' => 'required', 'nama_lembaga' => 'required', 'tanggal_mulai' => 'required|date', 'tanggal_selesai' => 'required|date|after:' . Request::input('tanggal_mulai'), 'alamat' => 'required'];
}
示例15: setCheckboxes
/**
* Set any checkbox fields that might be missing
*/
protected function setCheckboxes()
{
$this->mergeRequest($this->checkboxFields, function ($field) {
return Request::input($field, 0);
});
}