当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::has方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Request::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::has方法的具体用法?PHP Request::has怎么用?PHP Request::has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\Request的用法示例。


在下文中一共展示了Request::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postUserSettings

 public function postUserSettings()
 {
     $error = false;
     if (Request::has('user_id')) {
         $user_id = (int) Auth::user()->user_id;
         $input_id = (int) Request::input('user_id');
         if (Request::input('roles') === null) {
             $roles = [];
         } else {
             $roles = Request::input('roles');
         }
         if ($user_id === $input_id && !in_array(env('ROLE_ADMIN'), $roles, false)) {
             $roles[] = env('ROLE_ADMIN');
             $error = true;
         }
         $editUser = User::find(Request::input('user_id'));
         $editUser->roles()->sync($roles);
         $editUser->save();
         $this->streamingUser->update();
     }
     if ($error) {
         return redirect()->back()->with('error', 'Vous ne pouvez pas enlever le droit admin de votre compte!');
     }
     return redirect()->back();
 }
开发者ID:quentin-sommer,项目名称:WebTv,代码行数:25,代码来源:AdminController.php

示例2: anyIndex

 public function anyIndex()
 {
     //获取路由传入的参数
     //echo Route::input('name');
     //获取配置信息
     $value = config('app.timezone');
     //var_dump($value);
     //获取请求输入  http://host-8/web/user?name=dfse  输出:dfse
     $name1 = Request::has('name') ? Request::get('name') : '';
     //取得特定输入数据,若没有则取得默认值
     $name2 = Request::input('name', '默认值');
     $input = Request::all();
     //所有的
     $input = Request::input('products.0.name');
     //重定向
     //return redirect('login');
     //获取cookie
     $value = Request::cookie('name');
     //获取域名
     $url = Request::root();
     //		echo $url;
     $data = ['url' => $url, 'name1' => $name1, 'name2' => $name2, 'value' => $value];
     //响应视图   响应最常用的几个方法:make/view/json/download/redirectTo
     return response()->view('user.user', $data);
 }
开发者ID:breeze323136,项目名称:laravel,代码行数:25,代码来源:UserController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //$token = Input::post('token');
     if (Request::has('token')) {
         $token = Request::input('token');
         $compare = GlobalLibrary::compareToken($token);
         if ($compare) {
             $fullname = Request::input('f');
             $username = Request::input('u');
             $phone = Request::input('pn');
             $email = Request::input('e');
             $password = Request::input('pwd');
             $roles = Request::input('r');
             $field_users = array('name' => $username, 'email' => $email, 'password' => bcrypt($password));
             $count_users = User::where('email', '=', $email)->count();
             if ($count_users <= 0) {
                 $user = User::create($field_users);
                 $user_login = User::where('email', '=', $email)->first();
                 foreach ($user_login as $key => $value) {
                     $id = $user_login->id;
                 }
                 $field_user_detail = array('users_id' => $id, 'users_name' => $username, 'users_fullname' => $fullname, 'users_group_id' => $roles, 'users_email' => $email, 'users_status_id' => '1');
                 $user = table_users_detail::create($field_user_detail);
                 return (new Response(array('status' => true, 'msg' => 'Register successfully'), 200))->header('Content-Type', "json");
             } else {
                 return (new Response(array('status' => false, 'msg' => 'Email already registered'), 200))->header('Content-Type', "json");
             }
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed 2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed 1'), 200))->header('Content-Type', "json");
     }
 }
开发者ID:ekobudiarto,项目名称:msjd,代码行数:39,代码来源:controller_signup.php

示例4: showForumAction

 public function showForumAction()
 {
     if (Request::has('id')) {
         if (!Request::has('page_number')) {
             $page_number = 1;
         } else {
             $page_number = Request::get('page_number');
         }
         $parent = Page::where('id', '=', Request::input('id'))->first();
         if ($parent->is_sheet) {
             $messages = ForumPageMessage::where('page_id', '=', $parent->id)->take(3)->skip(($page_number - 1) * 3)->get();
             $users = User::all();
             $page_title = $parent->title;
             $messages_count = ForumPageMessage::where('page_id', '=', $parent->id)->count();
             return view('base.forum_page', ['messages' => $messages, 'page_id' => Request::input('id'), 'users' => $users, 'page_title' => $page_title, 'page_number' => $page_number, 'messages_count' => $messages_count]);
         }
         $childs = Page::where('parent_id', '=', $parent->id)->get();
     } else {
         $parent = Page::where('title', '=', 'Форум')->first();
         $childs = Page::where('parent_id', '=', $parent->id)->get();
     }
     $child_messages = null;
     foreach ($childs as $child) {
         if ($child->is_sheet) {
             $child_messages[] = ForumPageMessage::where('page_id', '=', $child->id)->get();
         }
     }
     return view('base.forum', ['topics' => $childs, 'parent_page' => $parent, 'page_messages' => $child_messages]);
 }
开发者ID:chelizminska,项目名称:laravel_new,代码行数:29,代码来源:BaseController.php

示例5: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (urlRequest::has('setstatus')) {
         $setStatus = (int) urlRequest::get('setstatus');
         $member = Member::find($id);
         $member->status = $setStatus;
         $member->save();
         return redirect()->back();
     }
 }
开发者ID:jallowmamadou,项目名称:balance-1,代码行数:16,代码来源:MembersshipsController.php

示例6: showLogs

 public static function showLogs($request)
 {
     $categories = Category::all();
     if (Request::has('filter')) {
         $date_filter = explode(' - ', $request->get('filter'));
         $deviceLogs = DeviceLog::with(['owner', 'device', 'user'])->whereBetween('created_at', [$date_filter[0], $date_filter[1]])->paginate(25);
         $deviceLogs->setPath('report');
     }
     return view('device_log.report', compact('deviceLogs', 'categories'));
 }
开发者ID:encry2024,项目名称:inv_5_2,代码行数:10,代码来源:DeviceLog.php

示例7: getFieldsFromRequest

 /**
  * This method returns an array of fields parsed from the request. `[*]` is returned by default (all fields).
  * Fields can be written in snake_case or camelCase. They are converted to snake_case automatically.
  *
  * Example: `?fields=column1,column2` is returned as `['column1', 'column2']`
  *
  * @return array
  */
 protected function getFieldsFromRequest($prefix = null)
 {
     if (Request::has('fields')) {
         $prefix = $prefix ? $prefix . '.' : '';
         return array_map(function ($field) use($prefix) {
             return $prefix . snake_case($field);
         }, explode(',', Request::get('fields')));
     }
     return ['*'];
 }
开发者ID:SerdarSanri,项目名称:laravel-rest,代码行数:18,代码来源:Command.php

示例8: updateToitem

 public function updateToitem($data)
 {
     if (Request::has('detail')) {
         if (isset(Request::get('detail')['id_detail'])) {
             Request::merge(Request::get('detail'));
             $soItem = new $this->detailClass();
             $soItem->putUpdate(Request::get('detail')['id_detail']);
         }
     }
 }
开发者ID:masmike,项目名称:scafolding,代码行数:10,代码来源:BaseModulController.php

示例9: link

 private function link($column, $text, $direction)
 {
     $params = $this->_appends + [$this->_keys['order'] => $column, $this->_keys['direction'] => $direction];
     if (Request::has($this->_keys['order']) && Request::input($this->_keys['order']) == $column && Request::input($this->_keys['direction']) == $direction) {
         return $text;
     }
     if (empty($this->_url)) {
         $this->_url = Request::url();
     }
     return '<a href="' . $this->_url . '?' . http_build_query($params) . '">' . $text . '</a>';
 }
开发者ID:sukohi,项目名称:caruta,代码行数:11,代码来源:Caruta.php

示例10: orderByColumns

 /**
  * Order by columns based on parameters
  *
  * @param \Illuminate\Database\Eloquent\Builder $query
  * @param string $orderBy
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public static function orderByColumns(Builder $query, $orderBy)
 {
     if (Request::has('orderbycolumn') == TRUE && Request::has('orderbytype') == TRUE) {
         $query->orderBy(Request::input('orderbycolumn'), Request::input('orderbytype'));
     } else {
         foreach ($orderBy as $orderByColumn => $orderByType) {
             $query->orderBy($orderByColumn, $orderByType);
         }
     }
     return $query;
 }
开发者ID:jdrda,项目名称:olapus,代码行数:18,代码来源:Helpers.php

示例11: image

 /**
  * handle image upload route
  */
 public function image()
 {
     if (Request::hasFile('image') && Request::has('table_name') && Request::has('field_name')) {
         return json_encode(self::saveImage(Request::input('table_name'), Request::input('field_name'), Request::file('image'), null, Request::file('image')->getClientOriginalExtension()));
     } elseif (!Request::hasFile('image')) {
         return 'no image';
     } elseif (!Request::hasFile('table_name')) {
         return 'no table_name';
     } elseif (!Request::hasFile('field_name')) {
         return 'no field_name';
     }
 }
开发者ID:left-right,项目名称:center,代码行数:15,代码来源:FileController.php

示例12: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (urlRequest::has('setstatus')) {
         $setStatus = (int) urlRequest::get('setstatus');
         $member = Member::find($id);
         $member->status = $setStatus;
         $member->save();
         return redirect()->back();
     }
     $data = $this->member->whereId((int) $id)->with('person.contacts', 'person.files', 'person.education')->first();
     return view('admin.show', compact('data'));
 }
开发者ID:jallowmamadou,项目名称:balance,代码行数:18,代码来源:MembersshipsController.php

示例13: postAdminDelete

 public function postAdminDelete()
 {
     session_start();
     Request::setTrustedProxies(array('192.0.0.1', '10.0.0.0/8'));
     if (isset($_SESSION["logged_in"]) && isset($_SESSION["logged_in_ip"]) && $_SESSION["logged_in_ip"] == Request::getClientIp()) {
         if (Request::has("id")) {
             $id = Request::input("id");
             DB::table("contestants")->where(array("id" => $id))->delete();
         }
     }
     return redirect()->action("AdminController@getAdminDelete");
 }
开发者ID:BennoDev,项目名称:WebDevelopment,代码行数:12,代码来源:AdminController.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $location = new Location();
     if (Request::has('location') && Request::input('location') != "") {
         $location->location = Request::input('location');
         $location->save();
         return Response::make("Success", 201);
     } else {
         // Bad request, missing parameters
         return Response::make("Please provide a time and location.", 400);
     }
 }
开发者ID:BrynnLawson,项目名称:smarka,代码行数:18,代码来源:LocationsController.php

示例15: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $notification = new Notification();
     if (Request::has('text') && Request::input('text') != "") {
         $notification->text = Request::input('text');
         $notification->save();
         return Response::make("Success", 201);
     } else {
         // Bad request, missing parameters
         return Response::make("Please provide a notification.", 400);
     }
 }
开发者ID:BrynnLawson,项目名称:smarka,代码行数:18,代码来源:NotificationsController.php


注:本文中的Illuminate\Support\Facades\Request::has方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。