當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Input::merge方法代碼示例

本文整理匯總了PHP中Input::merge方法的典型用法代碼示例。如果您正苦於以下問題:PHP Input::merge方法的具體用法?PHP Input::merge怎麽用?PHP Input::merge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Input的用法示例。


在下文中一共展示了Input::merge方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: store

 /**
  * Store a newly created resource in storage.
  * POST /users
  *
  * @return Response
  */
 public function store()
 {
     Input::merge(array_map('trim', Input::all()));
     $input = Input::all();
     $validation = Validator::make($input, User::$rules);
     if ($validation->passes()) {
         DB::transaction(function () {
             $user = new User();
             $user->first_name = strtoupper(Input::get('first_name'));
             $user->middle_initial = strtoupper(Input::get('middle_initial'));
             $user->last_name = strtoupper(Input::get('last_name'));
             $user->dept_id = Input::get('department');
             $user->confirmed = 1;
             $user->active = 1;
             $user->email = Input::get('email');
             $user->username = Input::get('username');
             $user->password = Input::get('password');
             $user->password_confirmation = Input::get('password_confirmation');
             $user->confirmation_code = md5(uniqid(mt_rand(), true));
             $user->image = "default.png";
             $user->save();
             $role = Role::find(Input::get('name'));
             $user->roles()->attach($role->id);
         });
         return Redirect::route('user.index')->with('class', 'success')->with('message', 'Record successfully added.');
     } else {
         return Redirect::route('user.create')->withInput(Input::except(array('password', 'password_confirmation')))->withErrors($validation)->with('class', 'error')->with('message', 'There were validation errors.');
     }
 }
開發者ID:jcyanga28,項目名稱:project-reference,代碼行數:35,代碼來源:UsersController.php

示例2: test_it_handles_filtering

 public function test_it_handles_filtering()
 {
     \Input::merge(['dvs-filters' => ['slug' => '/admin/media-manager/category']]);
     $pages = \DvsPage::paginate();
     // are pages filtered?
     // assertCount(2, $pages);
 }
開發者ID:alpas29,項目名稱:cms,代碼行數:7,代碼來源:SortTest.php

示例3: postVote

 public function postVote()
 {
     Input::merge(array_map('trim', Input::all()));
     $input = Input::all();
     $rules = array('MCUsername' => 'required|max:40', 'g-recaptcha-response' => 'required|recaptcha', 'sid' => 'required');
     $v = Validator::make($input, $rules);
     $sid = $input['sid'];
     $server = DB::table('mcservers')->where('mcs_id', '=', $sid)->first();
     if (!count($server)) {
         return Redirect::to('/minecraft/' . $sid)->withErrors("Ocorreu um erro com a validação do servidor");
     }
     if ($v->passes()) {
         if (mcservers::playerHasVoted($sid, $input['MCUsername']) || mcservers::ipHasVoted($sid, $_SERVER["HTTP_CF_CONNECTING_IP"])) {
             return Redirect::to('/minecraft/' . $sid)->withErrors("Já votaste hoje");
         }
         if ($server->mcs_votifier == 1) {
             $votifier = Votifier::newVote($server->mcs_ip, $server->mcs_vport, $server->mcs_votifierkey, $input['MCUsername']);
             if ($votifier == false) {
                 return Redirect::to('/minecraft/' . $sid)->withErrors("Não foi possivel enviar o voto para o servidor, porfavor contacta o admininstrador do mesmo");
             }
         }
         if (Auth::check()) {
             DB::table('users')->where('id', Auth::user()->id)->update(array('votes' => Auth::user()->votes + 1));
             utilities::log("Voted On Server " . $server->mcs_name);
         }
         DB::table('mcservers')->where('mcs_id', $sid)->update(array('mcs_tvotes' => $server->mcs_tvotes + 1, 'mcs_mvotes' => $server->mcs_mvotes + 1));
         DB::table('mcserversvotes')->insert(array('mcsv_sid' => $sid, 'mcsv_player' => $input['MCUsername'], 'mcsv_ip' => $_SERVER["HTTP_CF_CONNECTING_IP"], 'mcsv_day' => date("j"), 'mcsv_month' => date("n"), 'mcsv_year' => date("Y")));
         return Redirect::to('/minecraft/' . $sid)->With('success', 'Voto Registado!');
     } else {
         return Redirect::to('/minecraft/' . $sid)->withErrors($v);
     }
 }
開發者ID:G4brym,項目名稱:ServerList.pt,代碼行數:32,代碼來源:BaseController.php

示例4: cost_detail

 public function cost_detail()
 {
     // 默認渲染數據
     $render_data = ['previous_input' => ['date' => '', 'cost_type' => '10'], 'results' => []];
     $params = Input::all();
     // 參數非空,且指定查詢的消費類型,且指定的消費類型有效
     if (!empty($params)) {
         // 默認第一頁
         if (!Input::has('page')) {
             $params['page'] = 1;
         }
         if (!Input::has('date')) {
             $params['date'] = date('Y-m');
         }
         Input::merge($params);
         $render_data['previous_input'] = array_merge($render_data['previous_input'], $params);
         // 查詢充值記錄
         if ($params['cost_type'] == '10') {
             // 先查詢費用類型
             $fee_type = FeeType::select('id', 'category', 'item')->where('category', '10')->first();
             // 查詢費用明細所必須條件
             $render_data['results'] = CostDetail::select('cost_id', 'created_at', 'fee_type_id', 'number')->where('user_id', Sentry::getUser()->user_id)->where('fee_type_id', $fee_type->id)->where('created_at', 'like', $params['date'] . '%')->orderBy('created_at', 'desc')->get();
         } else {
             if ($params['cost_type'] == '20') {
                 $date = Carbon::parse(Input::get('date'));
                 $date_start = $date->timestamp * 1000;
                 $date->addMonth();
                 $date_end = $date->timestamp * 1000;
                 $render_data['results'] = BusinessController::count(Sentry::getUser()->user_id, $date_start, $date_end);
             }
         }
     }
     return View::make('pages.finance-center.cost-manage.cost-detail', $render_data);
 }
開發者ID:Jv-Juven,項目名稱:carService,代碼行數:34,代碼來源:CostManageController.php

示例5: testAuthState_authStateAccurateForLoggedInStateWithActing

 public function testAuthState_authStateAccurateForLoggedInStateWithActing()
 {
     $role = UserRole::where('name', '=', UserRole::ACTOR_ROLE)->first();
     $user = factory(App\Models\User::class, 1)->create();
     $user->password = 'password';
     $user->save();
     $user2 = factory(App\Models\User::class, 1)->create();
     $user2->password = 'password';
     $user2->save();
     $user->roles()->attach($role);
     App::bindShared('oauth2-server.authorizer', function () use($user) {
         $mock = Mockery::mock(\LucaDegasperi\OAuth2Server\Authorizer::class);
         $mock->shouldReceive('getResourceOwnerId')->andReturn($user->id);
         $mock->shouldReceive('getResourceOwnerType')->andReturn("user");
         return $mock;
     });
     Input::merge(array('access_token' => 'random_token'));
     Input::merge(array('act_as' => $user2->id));
     $adapter = App::make(APIAdapter::class);
     $state = $adapter->getAuthState();
     $this->assertFalse($state->rememberMe);
     $this->assertEquals($user->id, $state->userId);
     $this->assertEquals($user2->id, $state->actingUserId);
     $this->assertEquals(APIAdapter::AUTH_MECHANISM, $state->authMechanism);
 }
開發者ID:slice-beans,項目名稱:cqs-framework,代碼行數:25,代碼來源:APIAdapterTest.php

示例6: doLogin

 /**
  * 로그인 컨트롤러. 
  */
 public function doLogin($userid)
 {
     Input::merge(array('userid' => $userid));
     array_map('trim', Input::only('userid', 'userpw'));
     // 유효성 검사 rule
     $rules = array('userid' => Member::CONSTRAINT_USERID, 'userpw' => Member::CONSTRAINT_USERPW);
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
     }
     $member = Member::where(['userid' => Input::get('userid')])->where(['userpw' => Input::get('userpw')])->first();
     if (isset($member) && $member->getKey() >= 0) {
         // 토큰이 있다면 삭제.
         if ($member->token()) {
             $member->token()->delete();
         }
         // 새로운 토큰 발급.
         $memberToken = new Membertoken();
         $memberToken->token = Membertoken::getNewToken();
         $memberToken->memberSeq = $member->getKey();
         $memberToken->expiretime = Membertoken::getNewExpire();
         $memberToken->save();
         return Utils::result($memberToken->token);
     } else {
         return Utils::result(Utils::CANNOT_LOGIN, true);
     }
 }
開發者ID:naseil,項目名稱:Sound-Sleep-project-_-sugar-dream,代碼行數:29,代碼來源:MemberController.php

示例7: save

 public function save()
 {
     $name = $this->name();
     $value = Input::get($name, '');
     Input::merge([$name => $value]);
     parent::save();
 }
開發者ID:avilaj,項目名稱:ocsport,代碼行數:7,代碼來源:JsonField.php

示例8: post_edit

 public function post_edit($id)
 {
     // renew the team if necessary
     if (Auth::User()->admin || Auth::User()->is_currently_part_of_exec()) {
         $team = Team::find($id);
         if (!$team->is_active()) {
             if (Input::get('renew')) {
                 Year::current_year()->teams()->attach($team->id);
             }
         } else {
             if (!Input::get('renew')) {
                 Year::current_year()->teams()->detach($team->id);
             }
         }
     }
     $input = Input::get();
     $rules = array('name' => 'required', 'alias' => 'required|max:128', 'description' => 'required');
     $validation = Validator::make($input, $rules);
     if ($validation->passes()) {
         Input::merge(array('privacy' => Input::get('privacy', 0)));
         Team::find($id)->update(Input::except(array('renew')));
         return Redirect::to('rms/teams')->with('success', 'Successfully Edited Team');
     } else {
         return Redirect::to('rms/teams/edit/' . $id)->withErrors($validation)->withInput();
     }
 }
開發者ID:robinchow,項目名稱:rms,代碼行數:26,代碼來源:TeamsController.php

示例9: save

 public function save()
 {
     $name = $this->name();
     if (\Input::has($name)) {
         \Input::merge(array($name => password_hash($this->value(), PASSWORD_BCRYPT)));
         parent::save();
     }
 }
開發者ID:vuthaihoc,項目名稱:soa-sentinel,代碼行數:8,代碼來源:SentinelPassword.php

示例10: result

 public function result($freewords, $lang, $area)
 {
     global $data;
     global $settings;
     $this->getAreaGroups();
     $data['station_lines'] = $this->getStationLineList();
     if (Input::get('search_by') == NULL) {
         Input::merge(array('search_by' => 'station'));
     }
     $data['detail_search_by'] = Input::get('search_by');
     // set perPage
     $data['per_page'] = $settings['max_display_list']->default;
     if (in_array(Input::get('per-page'), $settings['max_display_list']->list)) {
         $data['per_page'] = Input::get('per-page');
     }
     if ($freewords != NULL) {
         $data['freewords'] = explode(' ', str_replace(' ', ' ', $freewords));
         Input::merge(array('freeword' => $freewords));
     }
     // get review items
     $this->getReviewItems();
     // get items informations
     $this->getItemInformations();
     // get orders
     $this->getOrders();
     // set search conditions
     $conditions = Input::all();
     $data['searchs'] = $conditions;
     // set display ways
     if (Input::get('display_way') != NULL) {
         $data['display_way'] = Input::get('display_way');
     } else {
         $data['display_way'] = $settings['list_display_ways'][0];
     }
     // get sub categories
     $data['sub_categories'] = $this->getSubCategoryList($data['categories'][$data['display_way']]['code']);
     // get lists
     if (Input::get('order') != NULL) {
         if (in_array(Input::get('order'), $data['categories'][$data['display_way']]['settings']['order_lists']['lists'])) {
             $data['order'] = $data['orders'][Input::get('order')];
         } else {
             $data['order'] = $data['orders'][$data['categories'][$data['display_way']]['settings']['order_lists']['default']];
         }
     } else {
         $data['order'] = $data['orders'][$data['categories'][$data['display_way']]['settings']['order_lists']['default']];
     }
     $this->getListsBySearch($data['searchs'], $data['display_way'], $data['per_page'], $data['order']['item'], $data['order']['order']);
     // create metas
     $data['page_keywords'] = $this->createPageKeywords();
     $data['page_title'] = $this->createResultPageTitle();
     $data['title'] = $data['page_title'] . " | " . $data['title'];
     $data['keywords'] = $data['page_title'] . "," . $data['keywords'];
     $data['description'] = $data['page_title'] . " | " . $data['description'];
     $data['breadcrumbs'] = array(array("text" => $data['texts']['home'], "url" => "/"), array("text" => $data['search_ways']['freeword'][$data['language']], "url" => "/freeword"), array("text" => $data['page_title']));
     // set settings
     $this->setSettingsInData();
     return Response::json($data)->setCallback(Input::get('callback'));
 }
開發者ID:KentaroMorishita,項目名稱:autham_portal_api,代碼行數:58,代碼來源:FreewordController.php

示例11: Handle

 /**
  * Handle the command
  *
  * @param $command
  * @return User
  */
 public function Handle($command)
 {
     $user = User::register($command->email, $command->name, $command->username, $command->password, $command->anonymousUser);
     \Input::merge(['userId' => $user->id]);
     // assign selected roles to the newly registered user
     $this->execute(UpdateUserRolesCommand::class);
     $this->dispatchEventsFor($user);
     return $user;
 }
開發者ID:arminsam,項目名稱:SimpleUserManagement,代碼行數:15,代碼來源:RegisterNewUserCommandHandler.php

示例12: display

 /**
  * Display the all the tutors with the serach options
  * @return [type] [description]
  */
 public function display()
 {
     //get the all the tutors first
     $tutors = Tutor::paginate($this->pageLimit);
     $subjects = Subjects::all();
     $levels = Subjects::getLevels();
     $districts = Districts::all();
     Input::merge(['levels' => 'Primary']);
     return View::make('search')->with(compact(['tutors', 'subjects', 'levels', 'districts']));
 }
開發者ID:marklauyq,項目名稱:firstclass-dev,代碼行數:14,代碼來源:TutorController.php

示例13: updateRequest

 /**
  * Custom API call function
  */
 public function updateRequest($method, $headers = array(), $data = array())
 {
     // Set the custom headers.
     \Request::getFacadeRoot()->headers->replace($headers);
     // Set the custom method.
     \Request::setMethod($method);
     // Set the content body.
     if (is_array($data)) {
         \Input::merge($data);
     }
 }
開發者ID:jalbertbowden,項目名稱:core,代碼行數:14,代碼來源:Definitions.php

示例14: processInput

 /**
  * Process and clean the POSTed data
  *
  * @access protected
  * @return void
  */
 protected function processInput()
 {
     $input = Input::all();
     // Trim leading and trailing whitespace
     // If the control's name is "data", we only trim trailing space
     foreach ($input as $key => $value) {
         $input[$key] = $key == 'data' ? rtrim($value) : trim($value);
     }
     // Merge it back to the Input data
     Input::merge($input);
 }
開發者ID:carriercomm,項目名稱:sticky-notes,代碼行數:17,代碼來源:BaseController.php

示例15: save

 public function save()
 {
     $name = $this->name();
     $value = Input::get($name, '');
     if (!empty($value)) {
         $value = explode(',', $value);
     } else {
         $value = [];
     }
     Input::merge([$name => $value]);
     parent::save();
 }
開發者ID:avilaj,項目名稱:ocsport,代碼行數:12,代碼來源:TetxList.php


注:本文中的Input::merge方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。