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


PHP Collection::get方法代码示例

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


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

示例1: send

 public function send(Collection $data)
 {
     $validator = $this->validator($data->toArray(), $this->type);
     if (!$validator->fails()) {
         Mailer::send("emails.{$this->type}", $data->toArray(), function ($message) use($data) {
             $fromAddress = $data->get('from_address');
             $fromName = $data->get('from_name');
             $toAddress = $data->get('to_address');
             $toName = $data->get('to_name');
             $cc = $data->get('cc[]', []);
             $bcc = $data->get('bcc[]', []);
             // Send the message
             $message->from($fromAddress, $fromName);
             $message->to($toAddress, $toName)->subject($data->get('subject'));
             foreach ($cc as $address) {
                 $message->cc($address, null);
             }
             foreach ($bcc as $address) {
                 $message->bcc($address, null);
             }
         });
     } else {
         // Validation failed
         return ['success' => 0, 'status' => "Failed to validate message", 'messages' => $validator->getMessageBag()->all(), 'data' => $data, 'type' => $this->type];
     }
     if (!count(Mailer::failures())) {
         $this->sent_at = Carbon::now();
         Log::info("Sent {$this->type} email");
         return ['success' => 1, 'status' => "successfully sent message", 'data' => $data, 'type' => $this->type];
     }
     Log::info("Failed to send {$this->type} email");
     return ['success' => 0, 'status' => "failed to send message", 'messages' => "failed to send message", 'data' => $data, 'type' => $this->type];
 }
开发者ID:wdmtech,项目名称:laravel-mail,代码行数:33,代码来源:Mail.php

示例2: isAllow

 /**
  * @param GrantableInterface $grantable
  * @param                    $action
  *
  * @return mixed
  */
 public function isAllow(GrantableInterface $grantable, $action)
 {
     if (is_null($this->permissions) || $this->permissions->isEmpty()) {
         $this->initialize($grantable);
     }
     return $this->permissions->get($action, false);
 }
开发者ID:ndrx-io,项目名称:elude,代码行数:13,代码来源:Manager.php

示例3: loadRules

 /**
  * @param string $key
  *
  * @return array
  */
 protected function loadRules($key)
 {
     if (!$this->rules->has($key)) {
         $this->rules->put($key, $this->loadRulesFromFile($key));
     }
     return $this->rules->get($key);
 }
开发者ID:vinicius73,项目名称:laravel-model-shield,代码行数:12,代码来源:Manager.php

示例4: evaluacion

 /**
  * obtener una evaluacion en específico
  * @param int $id
  * @return mixed|null
  */
 public function evaluacion($id)
 {
     if ($this->buscarEvaluacion($id) === false) {
         return null;
     }
     return $this->listaEvaluaciones->get($id);
 }
开发者ID:gerardoGomr,项目名称:sise,代码行数:12,代码来源:MemoEntrega.php

示例5: applications

 public function applications()
 {
     $apps = $this->items->get('applications');
     if (is_array($apps)) {
         $apps = $this->transformToCollections($apps);
     }
     return new Collection($apps);
 }
开发者ID:loduis,项目名称:artisan,代码行数:8,代码来源:Config.php

示例6: moveFile

 /**
  * @param File $image
  * @param string $prefix
  * @param String $path
  * @return string
  */
 public function moveFile(File $image, $path, $prefix = '')
 {
     $extension = $image->guessExtension();
     $code = strtoupper($this->request->get('code'));
     $fileName = $code . '-' . $prefix . '.' . $extension;
     $image->move(public_path() . $path, $fileName);
     return $path . $fileName;
 }
开发者ID:SkysoulDesign,项目名称:mirage.dev,代码行数:14,代码来源:CreateProductJob.php

示例7: instance

 /**
  * Get instance of type.
  *
  * @param  string $name
  * @param  bool $fresh
  * @return \GraphQL\Type\Definition\ObjectType
  */
 public function instance($name, $fresh = false)
 {
     if (!$fresh && $this->instances->has($name)) {
         return $this->instances->get($name);
     }
     $type = $this->getType($name)->resolve();
     $instance = $type instanceof Model ? (new EloquentType($type, $name))->toType() : $type->toType();
     $this->instances->put($name, $instance);
     return $instance;
 }
开发者ID:nuwave,项目名称:lighthouse,代码行数:17,代码来源:TypeRegistrar.php

示例8: searchIn

 /**
  * @param string|Model $model
  * @param string       $query
  * @param int|null     $perPage
  * @param string       $pageName
  *
  * @return LengthAwarePaginator|Collection
  * @throws \Exception
  */
 public function searchIn($model, $query = "", $perPage = null, $pageName = 'page')
 {
     if ($model instanceof Model) {
         $model = get_class($model);
     }
     if (!$this->models->offsetExists($model)) {
         throw new \Exception("Search engine for model [{$model}] not found");
     }
     return $this->_search([$this->models->get($model)], $query = "", $perPage = null, $pageName = 'page');
 }
开发者ID:kodicomponents,项目名称:searcher,代码行数:19,代码来源:Searcher.php

示例9: loadProvider

 /**
  * @param $provider
  *
  * @return Providers\ProvidersInterface;
  * @throws \Exception
  */
 private function loadProvider($provider)
 {
     if (!isset($this->providersAvailable[$provider])) {
         throw new \Exception('Lavatar provider ' . $provider . ' does not exist.');
     }
     $this->providersLoadeds[$provider] = app($this->providersAvailable[$provider]);
     $options = $this->config->get($provider, array());
     $this->providersLoadeds[$provider]->setupOptions($options);
     return $this->providersLoadeds[$provider];
 }
开发者ID:vinicius73,项目名称:lavatar,代码行数:16,代码来源:Lavatar.php

示例10: it_should_generate_a_module

 public function it_should_generate_a_module(Filesystem $filesystem, Mustache_Engine $mustache, Collection $c)
 {
     $filesystem->get('template.stub')->shouldBeCalled()->willReturn('template');
     $filesystem->put('js/modules/tacos/index.js', 'output')->shouldBeCalled();
     $mustache->render('template', ['model_path' => 'modules/tacos/models/taco', 'model' => 'Taco', 'collection_path' => 'modules/tacos/collections/tacos', 'collection' => 'TacoCollection', 'view_path' => 'modules/tacos/views/taco_view', 'view' => 'TacoView'])->shouldBeCalled()->willReturn('output');
     $c->get('model')->willReturn(new BackboneComponent('', 'modules/tacos/models/taco', 'Taco'))->shouldBeCalled();
     $c->get('view')->willReturn(new BackboneComponent('', 'modules/tacos/views/taco_view', 'TacoView'))->shouldBeCalled();
     $c->get('collection')->willReturn(new BackboneComponent('', 'modules/tacos/collections/tacos', 'TacoCollection'))->shouldBeCalled();
     $f = new BackboneComponent('js/modules/tacos/index.js', 'index', 'Index');
     $this->generate($f, 'template.stub', $c);
 }
开发者ID:mindofmicah,项目名称:backbone-module-command,代码行数:11,代码来源:IndexGeneratorSpec.php

示例11: process

 /**
  * Process the payload.
  * @param Collection $payload
  * @return Collection
  */
 public function process($payload)
 {
     $series = $payload->get('series');
     $game = $series->game;
     $creator = $payload->get('creator');
     $creator->persist();
     $creator->relatesToGame($game);
     $series->creator()->associate($creator->model);
     $creator->model->touch();
     return $payload;
 }
开发者ID:Gamespectre,项目名称:spectator-api,代码行数:16,代码来源:SaveCreator.php

示例12: item

 /**
  * Add a new Item (or edit an existing item) to the Group
  *
  * @param string   $name
  * @param callable $callback
  *
  * @return Item
  */
 public function item($name, Closure $callback = null)
 {
     if ($this->items->has($name)) {
         $item = $this->items->get($name);
     } else {
         $item = $this->container->make('Maatwebsite\\Sidebar\\Item');
         $item->name($name);
     }
     $this->call($callback, $item);
     $this->addItem($item);
     return $item;
 }
开发者ID:fordongu,项目名称:maigc-menubar,代码行数:20,代码来源:ItemableTrait.php

示例13: instance

 /**
  * Get instance of connection type.
  *
  * @param  string $name
  * @param  string|null $parent
  * @param  bool $fresh
  * @return \Nuwave\Lighthouse\Support\Definition\Fields\ConnectionField
  */
 public function instance($name, $parent = null, $fresh = false)
 {
     $instanceName = $this->instanceName($name);
     $typeName = $this->typeName($name);
     if (!$fresh && $this->instances->has($instanceName)) {
         return $this->instances->get($instanceName);
     }
     $key = $parent ? $parent . '.' . $instanceName : $instanceName;
     $nodeType = $this->getSchema()->typeInstance($typeName);
     $instance = $this->getInstance($name, $nodeType);
     $this->instances->put($key, $instance);
     return $instance;
 }
开发者ID:nuwave,项目名称:lighthouse,代码行数:21,代码来源:ConnectionRegistrar.php

示例14: determineHandler

 /**
  * @return \Spatie\SlashCommand\Handlers\BaseHandler
  *
  * @throws \Spatie\SlashCommand\Exceptions\RequestCouldNotBeHandled
  */
 protected function determineHandler()
 {
     $handler = collect($this->config->get('handlers'))->map(function (string $handlerClassName) {
         if (!class_exists($handlerClassName)) {
             throw InvalidHandler::handlerDoesNotExist($handlerClassName);
         }
         return new $handlerClassName($this->request);
     })->filter(function (HandlesSlashCommand $handler) {
         return $handler->canHandle($this->request);
     })->first();
     if (!$handler) {
         throw RequestCouldNotBeHandled::noHandlerFound($this->request);
     }
     return $handler;
 }
开发者ID:spatie,项目名称:laravel-slack-slash-command,代码行数:20,代码来源:Controller.php

示例15: parse

 /**
  * Parse parameters and return the altering classes
  *
  * @param  mixed $parameters
  * @return \Illuminate\Support\Collection
  */
 public function parse($parameters)
 {
     // Fetch parameters. If the variable is an array nothing will happen.
     // If it's a string, it will be tokenized and will return as an array.
     $params = $this->getParameters($parameters);
     $collection = new Collection();
     foreach ($params as $token => $value) {
         // create the manipulator
         $manipulator = $this->createManipulator($token);
         $className = get_class($manipulator);
         // get the classname
         if ($collection->has($className)) {
             $manipulator = $collection->get($className);
         }
         // set values
         if ($token === self::REQUEST_PARAM_WIDTH) {
             $manipulator->setWidth($value);
         } elseif ($token === self::REQUEST_PARAM_HEIGHT) {
             $manipulator->setHeight($value);
         }
         // put in the colllection
         $collection->put($className, $manipulator);
     }
     return $collection;
 }
开发者ID:nckg,项目名称:imageme,代码行数:31,代码来源:Request.php


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