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


PHP Collection::keys方法代码示例

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


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

示例1: getStoredUrls

 /**
  * @param bool $asArray
  * @return array|static
  **/
 public function getStoredUrls($asArray = false)
 {
     $keys = $this->lookups->keys();
     if ($asArray) {
         return $keys->toArray();
     } else {
         return $keys;
     }
 }
开发者ID:efrane,项目名称:letterpress,代码行数:13,代码来源:Repository.php

示例2: whatWouldYouLikeToRegister

 /**
  * Ask the user what they would like to register with the application
  *
  * @return void
  */
 public function whatWouldYouLikeToRegister()
 {
     $choices = $this->registrars->keys();
     $choices[] = 'No more';
     $registerType = $this->askWithCompletion('What would you like to register? (' . implode(', ', $choices->toArray()) . ')', $choices->toArray(), $choices->first());
     if ($registerType === 'No more') {
         foreach ($this->registrars as $registrar) {
             $registrar->afterRegistration();
         }
         $this->updateEnvFile();
         return;
     }
     if ($registerType == '' || !$this->registrars->has($registerType)) {
         $this->error('Unable to register that. Please try again.');
         $this->whatWouldYouLikeToRegister();
         return;
     }
     $this->registrars->get($registerType)->register();
     $this->whatWouldYouLikeToRegister();
 }
开发者ID:continuous-deployment,项目名称:pipes,代码行数:25,代码来源:Register.php

示例3: handle

 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     // New permissions
     $permissions = new Collection();
     // Remove not existing permissions
     Permission::whereNotIn('resource', $this->routes->keys()->toArray())->delete();
     foreach ($this->routes as $route) {
         // Do we have the current permission in the database. If so skip it...
         $existing_permission = Permission::where('resource', '=', $route['resource'])->first();
         if ($existing_permission) {
             continue;
         }
         // Skip some methods
         $data = $this->getPermissionData($route);
         if ($data['method'] == 'missingMethod') {
             continue;
         }
         // Add new permission
         $permissions->push(Permission::create($data));
     }
     $this->assignPermissions($permissions);
 }
开发者ID:aginev,项目名称:acl,代码行数:27,代码来源:SetPermissions.php

示例4: serialize

 public static function serialize(Collection &$cards, $attr = false)
 {
     $ary = [];
     foreach ($cards->keys() as $key) {
         $ary[$key] = $cards->get($key)->map(function ($item, $key) use($attr) {
             switch ($attr) {
                 case true:
                     return $item->toJSON();
                 case false:
                     return $item->getAttribute($item->getKeyName());
                 default:
                     //TODO: Complete attribute selection
                     $attributes = collect($item->getAttributes());
                     return 'TODO';
             }
         })->toArray();
     }
     $cards = json_encode($ary);
 }
开发者ID:ben-wells-kerenza,项目名称:snowdonia,代码行数:19,代码来源:Deck.php

示例5: testKeys

 public function testKeys()
 {
     $c = new Collection(['name' => 'taylor', 'framework' => 'laravel']);
     $this->assertEquals(['name', 'framework'], $c->keys()->all());
 }
开发者ID:sa7bi,项目名称:euro16,代码行数:5,代码来源:SupportCollectionTest.php

示例6: newQueryWithoutTenants

 /**
  * Get a new Eloquent Builder instance without any of the tenant scopes applied.
  *
  * @param Model $model
  *
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function newQueryWithoutTenants(Model $model)
 {
     return $model->newQuery()->withoutGlobalScopes($this->tenants->keys()->toArray());
 }
开发者ID:HipsterJazzbo,项目名称:Landlord,代码行数:11,代码来源:TenantManager.php

示例7: runCommandsWithParameters

 /**
  * Runs the given commands and paases them all the given parameters.
  *
  * @param Collection $commands
  * @param array $parameters
  *
  * @return void
  */
 private function runCommandsWithParameters(Collection $commands, array $parameters)
 {
     $commands->keys()->each(function ($command) use($parameters) {
         $this->call($command, $parameters);
     });
 }
开发者ID:cloudcreativity,项目名称:laravel-json-api,代码行数:14,代码来源:ResourceMakeCommand.php

示例8: getKeys

 /**
  * @return array
  */
 public function getKeys()
 {
     return $this->fields->keys()->all();
 }
开发者ID:KodiComponents,项目名称:module-datasource,代码行数:7,代码来源:FieldsCollection.php


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