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


PHP Arr::only方法代码示例

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


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

示例1: validate

 public static function validate($data)
 {
     if (is_null($data)) {
         return $data;
     }
     $arr = Arr::only($data, ['updated_at', 'access', 'publish_up', 'publish_down', 'published']);
     // check empty
     $fields = ['publish_up' => ['type' => 'datetime', 'value' => 'now()'], 'publish_down' => ['type' => 'datetime', 'value' => null], 'published' => '0'];
     foreach ($fields as $date_field => $default_value) {
         $type = null;
         if (is_array($default_value)) {
             // get type
             $type = isset($default_value['type']) ? $default_value['type'] : null;
             $default_value = isset($default_value['value']) ? $default_value['value'] : null;
         }
         if (empty($arr[$date_field])) {
             $arr[$date_field] = $default_value;
         } else {
             //
             // Test for datetime
             //
             // in MySQL, "2016-02-16 05:30 PM" --> "0000-00-00 00:00:00"
             // PostgreSQL seems okay ;)
             //
             if ($type == 'datetime' && ($value = strtotime($arr[$date_field])) !== false) {
                 $arr[$date_field] = date('Y-m-d H:i:s', $value);
             }
         }
     }
     return $arr;
 }
开发者ID:rudenyl-eeweb,项目名称:acp-module-articles,代码行数:31,代码来源:ArticleDomainDataRepository.php

示例2: authenticate

 /**
  * Authenticate the user.
  *
  * @param  array  $input
  *
  * @return bool
  */
 protected function authenticate($input)
 {
     $data = Arr::only($input, ['email', 'password']);
     $remember = isset($input['remember']) && $input['remember'] === 'yes';
     // We should now attempt to login the user using Auth class. If this
     // failed simply return false.
     return $this->auth->attempt($data, $remember);
 }
开发者ID:stevebauman,项目名称:foundation,代码行数:15,代码来源:AuthenticateUser.php

示例3: getS3PublicUrl

 public function getS3PublicUrl($config, $object_path = '')
 {
     $config += ['version' => 'latest'];
     if ($config['key'] && $config['secret']) {
         $config['credentials'] = Arr::only($config, ['key', 'secret']);
     }
     return (new S3Client($config))->getObjectUrl($config['bucket'], $object_path);
 }
开发者ID:LeeKevin,项目名称:stockphotos,代码行数:8,代码来源:FilesystemPublicUrlManager.php

示例4: compose

 /**
  * @param View $view
  */
 public function compose(View $view)
 {
     $auth = $this->session->get('auth');
     if (empty($auth) || !is_array($auth)) {
         return;
     }
     $view->with(Arr::only($auth, ['host', 'terminal', 'password']));
 }
开发者ID:rkgrep,项目名称:simkomat-emulator,代码行数:11,代码来源:Auth.php

示例5: connect

 /**
  * Establish a queue connection.
  *
  * @param array $config        	
  * @return \Illuminate\Contracts\Queue\Queue
  */
 public function connect(array $config)
 {
     $config += ['version' => 'latest'];
     if ($config['key'] && $config['secret']) {
         $config['credentials'] = Arr::only($config, ['key', 'secret']);
     }
     return new SqsQueue(new SqsClient($config), $config['queue']);
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:14,代码来源:SqsConnector.php

示例6: getFilteredOptions

 /**
  * Get filtered options.
  *
  * @param  array  $options
  *
  * @return array
  */
 protected function getFilteredOptions(array $options)
 {
     $default = $this->getDefaultOptions();
     $options = array_merge($default, $options);
     $uses = array_unique(array_merge(['path', 'filename', 'extension', 'format'], array_keys($default)));
     $data = Arr::only($options, $uses);
     return $data;
 }
开发者ID:bibimoto,项目名称:imagine,代码行数:15,代码来源:Generator.php

示例7: connect

 /**
  * Establish a queue connection.
  *
  * @param  array  $config
  * @return \Illuminate\Contracts\Queue\Queue
  */
 public function connect(array $config)
 {
     $config = array_merge(['version' => 'latest', 'http' => ['connect_timeout' => 60]], $config);
     if ($config['key'] && $config['secret']) {
         $config['credentials'] = Arr::only($config, ['key', 'secret']);
     }
     return new SqsQueue(new SqsClient($config), $config['queue']);
 }
开发者ID:jordanformanekdev,项目名称:Powerballer2.0,代码行数:14,代码来源:SqsConnector.php

示例8: connect

 /**
  * Establish a queue connection.
  *
  * @param array $config        	
  * @return \Illuminate\Contracts\Queue\Queue
  */
 public function connect(array $config)
 {
     $config = $this->getDefaultConfiguration($config);
     if ($config['key'] && $config['secret']) {
         $config['credentials'] = Arr::only($config, ['key', 'secret']);
     }
     return new SqsQueue(new SqsClient($config), $config['queue'], Arr::get($config, 'prefix', ''));
 }
开发者ID:sapwoo,项目名称:portfolio,代码行数:14,代码来源:SqsConnector.php

示例9: createSesDriver

 /**
  * Create an instance of the Amazon SES Swift Transport driver.
  *
  * @return \Swift_SendmailTransport
  */
 protected function createSesDriver()
 {
     $config = $this->app['config']->get('services.ses', []);
     $config += ['version' => 'latest', 'service' => 'email'];
     if ($config['key'] && $config['secret']) {
         $config['credentials'] = Arr::only($config, ['key', 'secret']);
     }
     return new SesTransport(new SesClient($config));
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:14,代码来源:TransportManager.php

示例10: store

 public function store($listener, array $inputs)
 {
     $validation = $this->validator->on('create')->with($inputs);
     if ($validation->fails()) {
     }
     $credentials = Arr::only($inputs, ['email', 'password', 'first_name', 'last_name']);
     $account = $this->account->createNewAccount($credentials);
     $profile = $this->profile->createUserProfile($account, Arr::except($inputs, $credentials));
     $this->fireEvent(self::MODULENAME, 'created', [$account]);
 }
开发者ID:shopalicious,项目名称:customer,代码行数:10,代码来源:Customer.php

示例11: getTransport

 /**
  * @param $key
  * @param $secret
  * @param $region
  *
  * @return \Illuminate\Mail\Transport\SesTransport
  * @throws \DreamFactory\Core\Exceptions\InternalServerErrorException
  */
 public static function getTransport($key, $secret, $region)
 {
     if (empty($key) || empty($secret) || empty($region)) {
         throw new InternalServerErrorException('Missing one or more configuration for SES service.');
     }
     $config = ['key' => $key, 'secret' => $secret, 'region' => $region, 'version' => 'latest', 'service' => 'email'];
     if ($config['key'] && $config['secret']) {
         $config['credentials'] = Arr::only($config, ['key', 'secret']);
     }
     return new SesTransport(new SesClient($config));
 }
开发者ID:pkdevboxy,项目名称:df-aws,代码行数:19,代码来源:Ses.php

示例12: getMethods

 static function getMethods($model)
 {
     $ret = [];
     $refl = new \ReflectionClass($model);
     foreach ($refl->getMethods() as $method) {
         $ret[$method->getName()]['method'] = $method;
         $relf_text = file($method->getFileName());
         $source = Arr::only($relf_text, range($method->getStartLine() - 1, $method->getEndLine() - 1));
         $source = array_map('trim', $source);
         $ret[$method->getName()]['source'] = implode('', $source);
         $ret[$method->getName()]['start'] = $method->getStartLine();
         $ret[$method->getName()]['end'] = $method->getEndLine();
     }
     return $ret;
 }
开发者ID:larakit,项目名称:lk,代码行数:15,代码来源:HelperModel.php

示例13: promiseUserWish

 /**
  * 承诺用户所期望的点歌要求
  *
  * @param $request
  * @param $wish
  *
  * @return string
  * @internal param $ \Illuminate\Http\Request $request* \Illuminate\Http\Request $request
  * @internal param $ array* $wish
  */
 private function promiseUserWish($request, $wish)
 {
     // 根据referer拿到当前歌曲的ID, 匹配的数字放入到数组下标为1的项
     preg_match('/\\/(\\d+)$/', $request->header('Referer'), $song);
     if (empty($song)) {
         /** 此处接收的是JSON格式 */
         $msg = \Illuminate\Support\Arr::only($request->json()->all(), ['receiver', 'message']);
         /* 保存新的点歌信息 */
         $song = \App\Song::storeNewSong($request->json('songName'), $request->json('singerName'));
     } else {
         if (is_numeric($song[1])) {
             /** 此处接收的是FORM-DATA */
             $msg = $request->only(['receiver', 'message']);
             $song = intval($song[1]);
         } else {
             /* 既不为空,也找不到对应歌曲ID就直接报错 */
             abort(405);
         }
     }
     return $this->writeUserWish($wish, $song, $msg);
 }
开发者ID:RedrockTeam,项目名称:jukebox,代码行数:31,代码来源:MusicController.php

示例14: createFlysystem

 /**
  * Create a Flysystem instance with the given adapter.
  *
  * @param  \League\Flysystem\AdapterInterface  $adapter
  * @param  array  $config
  * @return \Leage\Flysystem\FlysystemInterface
  */
 protected function createFlysystem(AdapterInterface $adapter, array $config)
 {
     $config = Arr::only($config, ['visibility']);
     return new Flysystem($adapter, count($config) > 0 ? $config : null);
 }
开发者ID:r8filipe,项目名称:LAPR,代码行数:12,代码来源:FilesystemManager.php

示例15: only

 /**
  * @param array $values
  * @return AttributeMapper
  */
 public function only(array $values) : AttributeMapper
 {
     $this->attributes = Arr::only($this->attributes, $values);
     return $this;
 }
开发者ID:Dualse,项目名称:GitterBot,代码行数:9,代码来源:AttributeMapper.php


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