本文整理汇总了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.');
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例7: save
public function save()
{
$name = $this->name();
$value = Input::get($name, '');
Input::merge([$name => $value]);
parent::save();
}
示例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();
}
}
示例9: save
public function save()
{
$name = $this->name();
if (\Input::has($name)) {
\Input::merge(array($name => password_hash($this->value(), PASSWORD_BCRYPT)));
parent::save();
}
}
示例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'));
}
示例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;
}
示例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']));
}
示例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);
}
}
示例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);
}
示例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();
}