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


PHP Collection::forget方法代码示例

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


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

示例1: apply

 /**
  * @param WithInterface|DataInterface|ModelInterface $config
  * @return mixed
  */
 public function apply($config)
 {
     if (!($config instanceof WithInterface && $config instanceof DataInterface && $config instanceof ModelInterface)) {
         return;
     }
     if ($config->with()->isEmpty()) {
         return;
     }
     $this->config = $config;
     $this->allowed = $config->with();
     foreach ($this->allowed as $key => $value) {
         if (is_numeric($key)) {
             $this->allowed->forget($key)->put($value, '*');
         }
     }
     foreach (explode('|', $config->data()->get('with', '')) as $with) {
         $parts = explode(':', $with);
         if (count($parts) == 0) {
             continue;
         }
         if (!$this->allowed->has($parts[0])) {
             continue;
         }
         $this->processWith($parts[0], isset($parts[1]) ? $parts[1] : '');
     }
     if (count($this->approved) > 0) {
         $config->model($config->model()->with($this->approved));
     }
 }
开发者ID:alex-oliveira,项目名称:ao-scrud,代码行数:33,代码来源:WithCriteria.php

示例2: destroy

 /**
  * Destroy a Satis repository.
  *
  * @param  \KevinDierkx\Muse\Repositories\Satis\RepositoryInterface  $model
  * @return \KevinDierkx\Muse\Repositories\Satis\RepositoryInterface
  */
 public function destroy(RepositoryInterface $model)
 {
     // TODO: Fire destroying event
     $this->repositories->forget($model->getId());
     $this->flush();
     // TODO: Fire destroyed event
     return $model;
 }
开发者ID:kevindierkx,项目名称:muse,代码行数:14,代码来源:RepositoryRepository.php

示例3: addExistsIntoItems

 /**
  * @param $key
  * @param $amount
  * @param $item
  */
 protected function addExistsIntoItems($key, $amount, $item)
 {
     $temp = $this->_items->get($key);
     $temp['amount'] += $amount;
     $this->_items->forget($key);
     $this->_items->push($temp);
     $this->_totalPrice += $amount * $item->getPrice();
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:13,代码来源:SessionDrivenCart.php

示例4: removeMapping

 /**
  * @param string $type
  *
  * @return $this
  */
 public function removeMapping($type)
 {
     $this->mappings->forget($type);
     $mappings = $this->getMappingsForClass($type);
     foreach ($mappings as $key) {
         $this->mappings->forget($key);
     }
     return $this;
 }
开发者ID:illuminate3,项目名称:laravel-doctrine-tenancy,代码行数:14,代码来源:TenantTypeResolver.php

示例5: isPublished

 protected function isPublished(ServiceType $servicetype, Collection &$publishing)
 {
     foreach ($publishing as $key => $item) {
         if ($item['name'] == $servicetype->name) {
             $publishing->forget($key);
             return true;
         }
     }
     return false;
 }
开发者ID:josevh,项目名称:timegrid,代码行数:10,代码来源:ServiceTypeController.php

示例6: forget

 /**
  * @param $key
  *
  * @return bool
  */
 public function forget($key)
 {
     if ($this->fireEvent('deleting', [$key]) === false) {
         return false;
     }
     $this->data->forget($key);
     $this->fireEvent('deleted', [$key], false);
     $this->dirty[] = $key;
     return true;
 }
开发者ID:portonefive,项目名称:essentials,代码行数:15,代码来源:Dictionary.php

示例7: cleanSearch

 /**
  * Cleans the search results into authors with names that are
  * similar to the one that was searched.
  *
  * @param $query    String name of the author
  * @param $results  Collection containing the authors
  * @return mixed    Collection
  */
 protected function cleanSearch(string $query, Collection $results)
 {
     debug('Cleaning author search');
     foreach ($results as $author => $books) {
         // We only want to keep authors whose name is similar to our search query
         if ($this->authorsNameIsSimilar($query, $author)) {
             continue;
         }
         debug("Filtering {$author} from the results");
         $results->forget($author);
     }
     return $results;
 }
开发者ID:ScottBurfieldMills,项目名称:BookFeed,代码行数:21,代码来源:ResultsCleaner.php

示例8: agregarOtroTratamiento

 /**
  * agregar nuevo "otro" tratamiento al plan
  * @param int $indice
  * @param OtroTratamiento $tratamiento
  */
 public function agregarOtroTratamiento($indice, OtroTratamiento $tratamiento)
 {
     if (is_null($this->listaOtrosTratamientos)) {
         $this->listaOtrosTratamientos = new Collection();
     }
     /*if (count($this->listaTratamientos) === 2) {
           throw new \Exception('Solo se permiten hasta dos tratamientos por diente');
       }*/
     // si ya está ocupada la posición, la elimina para permitir agregar uno nuevo
     if ($this->listaOtrosTratamientos->has($indice)) {
         $this->listaOtrosTratamientos->forget($indice);
     }
     $this->listaOtrosTratamientos->put($indice, $tratamiento);
 }
开发者ID:gerardoGomr,项目名称:siacme,代码行数:19,代码来源:PlanTratamiento.php

示例9: deleteRowOrder

 /**
  * Deletes a row given a product id
  * @param $product_id
  * @throws Palmabit\Library\Exceptions\NotFoundException
  */
 public function deleteRowOrder($product_id)
 {
     $success = false;
     foreach ($this->row_orders as $key => $order) {
         if ($order->product_id == $product_id) {
             $this->row_orders->forget($key);
             $success = true;
         }
     }
     if (!$success) {
         throw new NotFoundException();
     }
     return $this;
 }
开发者ID:palmabit,项目名称:catalog,代码行数:19,代码来源:Order.php

示例10: filterEmptyGroups

 /**
  * Removes any empty groups from the compiled menu trees.
  *
  * @return $this
  */
 protected function filterEmptyGroups()
 {
     // Grouped
     $remove = [];
     foreach ($this->menuGroups as $key => $presence) {
         if (!$this->filterNestedEmptyGroups($presence)) {
             $remove[] = $key;
         }
     }
     $this->menuGroups->forget($remove);
     // Ungrouped
     $remove = [];
     foreach ($this->menuUngrouped as $key => $presence) {
         if (!$this->filterNestedEmptyGroups($presence)) {
             $remove[] = $key;
         }
     }
     $this->menuGroups->forget($remove);
     // Alternative presences should be left as is, to be determined
     // by whatever front-end implementation they may get.
     return $this;
 }
开发者ID:czim,项目名称:laravel-cms-core,代码行数:27,代码来源:MenuRepository.php

示例11: revokeRole

 /**
  * Revoke role.
  *
  * @param string      $role_name
  * @param object|null $resource
  *
  * @return bool
  */
 public function revokeRole($role_name, $resource = null)
 {
     // Search Roles in Cache
     $delete_roles = $this->roles->filter(function ($role) use($role_name, $resource) {
         return $this->checkRole($role, $role_name, $resource);
     });
     if (!$delete_roles->count()) {
         return true;
     }
     $model_type = get_class($this->model);
     $model_id = $this->model->getKey();
     $delete = Role::where('model_type', $model_type)->where('model_id', $model_id)->where('role_name', $role_name);
     if (is_object($resource)) {
         $resource_type = get_class($resource);
         $resource_id = $resource->getKey();
         $delete->where('resource_type', $resource_type)->where('resource_id', $resource_id);
     }
     $delete->delete();
     foreach ($delete_roles->pluck('id') as $id) {
         $this->roles->forget($id);
     }
     return $delete;
 }
开发者ID:lbausch,项目名称:laravel-fortress,代码行数:31,代码来源:Guard.php

示例12: removeCriteria

 /**
  * Removes criteria by key, if it exists
  *
  * @param string $key
  * @return $this
  */
 public function removeCriteria($key)
 {
     $this->criteria->forget($key);
     return $this;
 }
开发者ID:czim,项目名称:laravel-repository,代码行数:11,代码来源:BaseRepository.php

示例13: getAuthData

 /**
  * @param Collection $inputs
  * @return mixed
  */
 private function getAuthData($inputs)
 {
     $auth_data = $inputs->get('authData');
     $inputs->forget('authData');
     return $auth_data;
 }
开发者ID:malimu,项目名称:baas,代码行数:10,代码来源:UserController.php

示例14: buildQuickPassageStats

 public static function buildQuickPassageStats($games)
 {
     $combined = [];
     $combined['stats'] = ['pandaPts' => 0, 'opponentPts' => 0, 'pandaWins' => 0, 'opponentWins' => 0, 'totalGames' => 0, 'blowoutGames' => 0, 'differentMaps' => false];
     $combined['buffs'] = ['favor' => false, 'mercy' => false, 'boon' => false, 'boon-or-favor' => false, 'quitout' => 0];
     $previous = null;
     $maps = new Collection();
     foreach ($games as $game) {
         $pandaId = $game->pvp->pandaId;
         $opponentId = $game->pvp->opposite($pandaId);
         if ($maps->has($game->referenceId)) {
             $count = $maps->get($game->referenceId);
             $maps->forget($game->referenceId);
             $maps->put($game->referenceId, ++$count);
         } else {
             $maps->put($game->referenceId, 1);
         }
         $combined['stats']['pandaPts'] += $game->pvp->pts($pandaId);
         $combined['stats']['opponentPts'] += $game->pvp->pts($opponentId);
         $combined['stats']['pandaWins'] += $pandaId == $game->pvp->winnerId ? 1 : 0;
         $combined['stats']['opponentWins'] += $opponentId == $game->pvp->winnerId ? 1 : 0;
         $combined['stats']['totalGames'] += 1;
         // Check if PandaLove blew them out (15 - 0)
         // Update: Trials #2 maxes at 5-0
         // Update: Forget max, just check if enemy got 0pts
         if ($pandaId == $game->pvp->winnerId) {
             if ($game->pvp->pts($opponentId) == 0) {
                 $combined['stats']['blowoutGames'] += 1;
             }
         }
         if ($previous == null) {
             $previous = $game->referenceId;
         } else {
             if ($previous != $game->referenceId) {
                 $combined['stats']['differentMaps'] = true;
             }
         }
         foreach ($game->players as $player) {
             $id = $player->account->membershipId;
             if ($player->account->isPandaLove() || $player->team == $pandaId) {
                 // check for unbroken
                 if ($player->deaths == 0) {
                     if (isset($combined['stats']['unbroken'][$id])) {
                         $combined['stats']['unbroken'][$id]['count'] += 1;
                     } else {
                         $combined['stats']['unbroken'][$id] = ['gamertag' => $player->account->gamertag, 'seo' => $player->account->seo, 'count' => 1];
                     }
                 }
             }
         }
     }
     // are we on different maps? If so lets get the names of them
     if ($combined['stats']['differentMaps']) {
         $map_list = '';
         $new_maps = null;
         $maps->each(function ($count, $map) use(&$map_list, &$new_maps) {
             $map_list .= Hashes::quick($map)['title'] . ", ";
         });
         $combined['stats']['maps'] = rtrim($map_list, ", ");
         $new_maps = $maps->toArray();
         arsort($new_maps);
         $combined['stats']['rMaps'] = $new_maps;
     }
     $bonus = 0;
     if ($combined['stats']['pandaWins'] < 7) {
         $combined['buffs']['quitout'] = 7 - $combined['stats']['pandaWins'];
         $bonus += $combined['buffs']['quitout'];
     }
     // Lets check for Boon/Mercy/Favor of Osiris
     if ($combined['stats']['pandaWins'] != $combined['stats']['totalGames']) {
         // Our Panda # of wins does not equal total games, therefore a loss was encountered
         $combined['buffs']['mercy'] = true;
     }
     if ($combined['stats']['pandaWins'] == 8 - $bonus) {
         // We have 8 wins. This means the group could of either used a Boon (First win = two wins)
         // or a Favor (start with 1 win).
         $combined['buffs']['boon-or-favor'] = true;
     }
     if ($combined['stats']['pandaWins'] == 7 - $bonus) {
         // We have 7 wins. That means both the Boon and Favor was used.
         $combined['buffs']['favor'] = true;
         $combined['buffs']['boon'] = true;
     }
     return $combined;
 }
开发者ID:GMSteuart,项目名称:PandaLove,代码行数:85,代码来源:Game.php

示例15: quitarEvaluacion

 /**
  * remover evaluacion
  * @param int $id
  */
 public function quitarEvaluacion($id)
 {
     $this->listaEvaluaciones->forget($id);
 }
开发者ID:gerardoGomr,项目名称:sise,代码行数:8,代码来源:EntregaArchivo.php


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