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


PHP array_forget函数代码示例

本文整理汇总了PHP中array_forget函数的典型用法代码示例。如果您正苦于以下问题:PHP array_forget函数的具体用法?PHP array_forget怎么用?PHP array_forget使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $this->config = $this->getConfig();
     $opts = $this->option();
     if ($opts['forget']) {
         if (isset(array_dot($this->config)[$opts['forget']])) {
             $keys = explode('.', $opts['forget']);
             array_forget($this->config, $opts['forget']);
             if (empty($this->config[$keys[0]])) {
                 DB::table('config')->where('name', $keys[0])->delete();
             } else {
                 DB::table('config')->where('name', $keys[0])->update(['value' => serialize($this->config[$keys[0]])]);
             }
             $this->info($opts['forget'] . ' removed.');
         }
         return $this->showList();
     }
     if ($opts['key'] && $opts['value']) {
         $value = trim($opts['value']);
         if (in_array($value, ['true', 'false', '0', '1'])) {
             $value = filter_var($value, FILTER_VALIDATE_BOOLEAN);
         }
         $old_config = $this->config;
         array_set($this->config, $opts['key'], $value);
         $keys = explode('.', $opts['key']);
         if (isset($old_config[$keys[0]])) {
             //update
             DB::table('config')->where('name', $keys[0])->update(['value' => serialize($this->config[$keys[0]])]);
         } else {
             //insert
             DB::table('config')->insert(['name' => $keys[0], 'value' => serialize($this->config[$keys[0]])]);
         }
     }
     return $this->showList();
 }
开发者ID:vik0803,项目名称:ticketl4,代码行数:40,代码来源:ConfigCommand.php

示例2: open

 /**
  * @param array $options
  * @return string
  */
 public function open(array $options = [])
 {
     $this->errors = array_get($options, 'errors');
     array_forget($options, 'errors');
     array_set($options, 'files', true);
     return parent::open($options);
 }
开发者ID:stevenklar,项目名称:admin,代码行数:11,代码来源:FormBuilder.php

示例3: prepareData

 public function prepareData($data)
 {
     if (isset($data['avatar'])) {
         if (!in_array($this->data['avatar']->mimeType, $this->images)) {
             $this->errors->messages = array_add($this->errors->messages, 'avatar', $this->array);
         } else {
             $data = $this->moveAvatar($data);
             $data['available_perfil'] = true;
         }
     } else {
         array_forget($data, 'avatar');
     }
     if (isset($data['ficha1'])) {
         $data = $this->moveFicha1($data);
     } else {
         array_forget($data, 'ficha1');
     }
     if (isset($data['ficha2'])) {
         $data = $this->moveFicha2($data);
     } else {
         array_forget($data, 'ficha2');
     }
     $data['full_name'] = strip_tags($data['full_name']);
     $data['movil'] = strip_tags($data['movil']);
     $data['institucion_procedencia'] = strip_tags($data['institucion_procedencia']);
     $data['estado'] = strip_tags($data['estado']);
     $data['municipio'] = strip_tags($data['municipio']);
     $data['domicilio'] = strip_tags($data['domicilio']);
     return $data;
 }
开发者ID:jogs78,项目名称:talleres,代码行数:30,代码来源:ForaneoPerfilManejador.php

示例4: prepareData

 protected function prepareData($fill)
 {
     if (empty($fill['sites_id'])) {
         $fill['sites_id'] = app('veer')->siteId;
     }
     if (empty($fill['users_id']) && $this->action != 'add') {
         $fill['users_id'] = \Auth::id();
     }
     foreach (['free', 'close', 'hidden', 'archive', 'delivery_free', 'delivery_hold', 'payment_hold', 'payment_done'] as $key) {
         $fill[$key] = isset($fill[$key]) ? 1 : 0;
     }
     if ($fill['close']) {
         $fill['close_time'] = now();
     }
     $fill['progress'] = isset($fill['progress']) ? strtr($fill['progress'], ["%" => ""]) : 5;
     $fill['delivery_plan'] = !empty($fill['delivery_plan']) ? parse_form_date($fill['delivery_plan']) : null;
     $fill['delivery_real'] = !empty($fill['delivery_real']) ? parse_form_date($fill['delivery_real']) : null;
     $fill += ['cluster_oid' => null, 'cluster' => null, 'delivery_method_id' => $this->order->delivery_method_id, 'payment_method_id' => $this->order->payment_method_id, 'status_id' => $this->order->status_id, 'userbook_id' => $this->order->userbook_id];
     if ($this->order->cluster_oid != $fill['cluster_oid'] || $this->order->cluster != $fill['cluster']) {
         $existingOrders = \Veer\Models\Order::where('sites_id', '=', $fill['sites_id'])->where('cluster', '=', $fill['cluster'])->where('cluster_oid', '=', $fill['cluster_oid'])->first();
         // we cannot update cluster ids if they already exist
         if (is_object($existingOrders) || empty($fill['cluster_oid'])) {
             array_forget($fill, ['cluster_oid', 'cluster']);
         }
     }
     if ($this->order->delivery_method_id != $fill['delivery_method_id'] && empty($fill['delivery_method'])) {
         $fill['delivery_method'] = \Veer\Models\OrderShipping::where('id', '=', $fill['delivery_method_id'])->pluck('name');
     }
     if ($this->order->payment_method_id != $fill['payment_method_id'] && empty($fill['payment_method'])) {
         $fill['payment_method'] = \Veer\Models\OrderPayment::where('id', '=', $fill['payment_method_id'])->pluck('name');
     }
     return $fill;
 }
开发者ID:artemsk,项目名称:veer-core,代码行数:33,代码来源:Order.php

示例5: except

 /**
  * Get all of the data except for a specified array of items.
  *
  * @param  array  $keys
  * @return array
  */
 public function except($keys)
 {
     $keys = is_array($keys) ? $keys : func_get_args();
     $results = $this->all();
     array_forget($results, $keys);
     return $results;
 }
开发者ID:pushoperations,项目名称:decorators,代码行数:13,代码来源:DataDecorator.php

示例6: signPacket

 /**
  * Generates a signature for a packet request response
  *
  * @param array                  $packet
  * @param int|null               $code
  * @param string|\Exception|null $message
  *
  * @return array
  *
  */
 protected static function signPacket(array $packet, $code = null, $message = null)
 {
     $_ex = false;
     if ($code instanceof \Exception) {
         $_ex = $code;
         $code = null;
     } elseif ($message instanceof \Exception) {
         $_ex = $message;
         $message = null;
     }
     !$code && ($code = Response::HTTP_OK);
     $code = $code ?: ($_ex ? $_ex->getCode() : Response::HTTP_OK);
     $message = $message ?: ($_ex ? $_ex->getMessage() : null);
     $_startTime = \Request::server('REQUEST_TIME_FLOAT', \Request::server('REQUEST_TIME', $_timestamp = microtime(true)));
     $_elapsed = $_timestamp - $_startTime;
     $_id = sha1($_startTime . \Request::server('HTTP_HOST') . \Request::server('REMOTE_ADDR'));
     //  All packets have this
     $_packet = array_merge($packet, ['error' => false, 'status_code' => $code, 'request' => ['id' => $_id, 'version' => static::PACKET_VERSION, 'signature' => base64_encode(hash_hmac(config('dfe.signature-method'), $_id, $_id, true)), 'verb' => \Request::method(), 'request-uri' => \Request::getRequestUri(), 'start' => date('c', $_startTime), 'elapsed' => (double) number_format($_elapsed, 4)]]);
     //  Update the error entry if there was an error
     if (!array_get($packet, 'success', false) && !array_get($packet, 'error', false)) {
         $_packet['error'] = ['code' => $code, 'message' => $message, 'exception' => $_ex ? Json::encode($_ex) : false];
     } else {
         array_forget($_packet, 'error');
     }
     return $_packet;
 }
开发者ID:rajeshpillai,项目名称:dfe-common,代码行数:36,代码来源:BasePacket.php

示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param UpdateUserRequest $request
  *
  * @return bool
  */
 public function update($request)
 {
     $inputs = $request->all();
     if ($this->user->is_validate && !Hash::check($inputs['current_password'], $this->user->password)) {
         return false;
     }
     if (!$this->user->is_validate && empty($inputs['password'])) {
         return false;
     }
     if (!isset($inputs['phone']) || empty($inputs['phone'])) {
         $inputs['is_phone'] = false;
     }
     if (empty($inputs['password'])) {
         array_forget($inputs, ['password', 'password_confirm']);
     }
     if ($request->hasFile('avatar')) {
         $this->makeAvatarFor($this->user, $request->file('avatar'));
     }
     $this->user->fill($inputs);
     $this->user->is_validate = 1;
     event(new UserWillBeUpdated($this->user, $this->user));
     $this->user->save();
     event(new UserWasUpdated($this->user, $this->user));
     return true;
 }
开发者ID:zedx,项目名称:core,代码行数:32,代码来源:UserService.php

示例8: prepareData

 public function prepareData($data)
 {
     if (isset($data['avatar'])) {
         $data = $this->moveAvatar($data);
         $data['available_perfil'] = true;
     } else {
         array_forget($data, 'avatar');
     }
     if (isset($data['ficha1'])) {
         $data = $this->moveFicha1($data);
     } else {
         array_forget($data, 'ficha1');
     }
     if (isset($data['ficha2'])) {
         $data = $this->moveFicha2($data);
     } else {
         array_forget($data, 'ficha2');
     }
     $data['full_name'] = strip_tags($data['full_name']);
     $data['movil'] = strip_tags($data['movil']);
     $data['num_control'] = strip_tags($data['num_control']);
     $data['estado'] = strip_tags($data['estado']);
     $data['municipio'] = strip_tags($data['municipio']);
     $data['domicilio'] = strip_tags($data['domicilio']);
     return $data;
 }
开发者ID:jogs78,项目名称:talleres,代码行数:26,代码来源:IttgPerfilManejador.php

示例9: forget

 /**
  * Remove element from settings array
  *
  * @param $key
  */
 public function forget($key)
 {
     if ($this->has($key)) {
         array_forget($this->data, $key);
     }
     $this->persist();
 }
开发者ID:jfadich,项目名称:json-property,代码行数:12,代码来源:JsonProperty.php

示例10: addEntryFields

 /**
  * Return field groups and field for entry by slug
  * @return void
  */
 public function addEntryFields($entry)
 {
     if ($this->entry_fields) {
         // Get fields by entry slug
         $entryKey = str_replace("-", "_", $entry->slug);
         $entryFields = array_get($this->entry_fields, $entryKey);
         if ($entryFields) {
             foreach ($entryFields as $groupKey => $fields) {
                 // Add field to existing group or create new one
                 if ($this->groups->has($groupKey)) {
                     foreach ($fields as $key => $field) {
                         $this->groups[$groupKey]->fields->put($key, $f = new FieldEntity($field));
                         $this->fields->put($key, $f);
                     }
                 } else {
                     $this->groups->put($groupKey, new FieldGroupEntity($fields));
                     // Also add the fields to global list
                     foreach ($this->groups[$groupKey]->fields as $newKey => $newField) {
                         $this->fields->put($newKey, $newField);
                     }
                 }
             }
         }
         array_forget($this->data, 'entry_fields');
     }
 }
开发者ID:creolab,项目名称:krustr,代码行数:30,代码来源:ChannelEntity.php

示例11: getDefaultTransformerNamespace

 /**
  * Get the default transformer class for the model.
  *
  * @return string
  */
 protected function getDefaultTransformerNamespace()
 {
     $parts = explode('\\', get_class($this));
     $class = array_last($parts);
     array_forget($parts, array_last(array_keys($parts)));
     return $this->makeTransformer($class, implode('\\', $parts));
 }
开发者ID:erikgall,项目名称:transformer,代码行数:12,代码来源:TransformableModel.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $rules = ['c_fname' => 'required|min:2', 'c_lname' => 'required|min:2', 'address' => 'required|min:2', 'city' => 'required|min:2', 'sate' => 'required|min:2', 'phone' => 'required|min:2|unique:merchants', 'email' => 'required|min:5|unique:merchants'];
     $messages = [];
     $validator = Validator::make($request->all(), ['c_fname' => 'required|min:2', 'c_lname' => 'required|min:2', 'address' => 'required|min:2', 'city' => 'required|min:2', 'state' => 'required|min:2', 'phone' => 'required|min:2|unique:merchants']);
     $validator->setAttributeNames(['c_fname' => "Contcat First Name", "c_lname" => "Contact Last Name"]);
     //$validator->setAttributeName()
     if ($validator->fails()) {
         if ($request->ajax()) {
             return response()->json($validator->messages());
         } else {
             return \Redirect::back()->withErrors($validator)->withInput();
         }
     }
     $all_request = $request->all();
     array_forget($all_request, "_token");
     $mid = Merchant::uniqueID() + 1;
     $merchant = new Merchant();
     foreach ($all_request as $key => $value) {
         $merchant->{$key} = $value;
     }
     $merchant->merch_id = $mid;
     if ($merchant->save()) {
         return response()->json("record saved successfully");
     }
     return View("merchants.index", ["merchants" => Merchant::all(), "title" => "Merchant"]);
 }
开发者ID:runningjack,项目名称:busticketAdmin,代码行数:34,代码来源:MerchantController.php

示例13: testArrayForget

 public function testArrayForget()
 {
     $array = array('names' => array('developer' => 'taylor', 'otherDeveloper' => 'dayle'));
     array_forget($array, 'names.developer');
     $this->assertFalse(isset($array['names']['developer']));
     $this->assertTrue(isset($array['names']['otherDeveloper']));
 }
开发者ID:hochanh,项目名称:Bootsoft-Bowling,代码行数:7,代码来源:HelpersTest.php

示例14: update

 public function update(Request $request, $id)
 {
     array_forget($request, "_token");
     $all_request = $request->all();
     $task = Task::find($id);
     foreach ($all_request as $key => $value) {
         /*
          * remove all underscore contained
          * in the edit form field
          */
         $key = preg_replace("/^_/", "", $key);
         $task->{$key} = $value;
     }
     if ($task->update()) {
         \Session::flash("success_message", "Task Successfully Updated");
     } else {
         \Session::flash("error_message", "Unexpected Error Task could not be updated");
     }
     $tasks = Task::all();
     if ($request->ajax()) {
         response()->json("Task Successfully Updated");
         exit;
         // return \Redirect::back();
     }
     return View("taskmanager.index", ['tasks' => $tasks, 'title' => 'Tasks']);
 }
开发者ID:runningjack,项目名称:coalitionlaravel2,代码行数:26,代码来源:TaskController.php

示例15: except

 /**
  * Get only designated inputs.
  * @param array $keys 
  * @param array  ['trim' => bool $trim, 'sanitize' => bool $sanitize, 'clean' => bool $clean ] 
  * @return array
  */
 public function except(array $keys, array $param = array())
 {
     $input = $this->getAll();
     foreach ($keys as $key) {
         array_forget($input, $key);
     }
     return $this->clean($input, $param);
 }
开发者ID:weboap,项目名称:winput,代码行数:14,代码来源:Winput.php


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