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


PHP Model::all方法代码示例

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


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

示例1: boot

 /**
  * Defer loading of Collection until needed
  * @return void
  */
 protected function boot()
 {
     if (!is_null($this->collection)) {
         return;
     }
     $this->collection = $this->model->all();
 }
开发者ID:khaliqgant,项目名称:Deep,代码行数:11,代码来源:AbstractDeferredRepository.php

示例2: index

 public function index()
 {
     $roles = $this->roleModel->all();
     $permissions = $this->permissionService->getGroupedByControllerPermissions();
     $roleCount = count($roles);
     $rolePermissions = $this->roleService->getRolePermissions();
     $activePermissions = $this->roleService->getRolePermissions();
     return view('aliukevicius/laravelRbac::permissions.index', compact('roles', 'permissions', 'activePermissions', 'roleCount', 'rolePermissions'));
 }
开发者ID:aliukevicius,项目名称:laravel-rbac,代码行数:9,代码来源:PermissionController.php

示例3: openSource

 /**
  * Open Eloquent Source
  *
  * @return bool
  */
 public function openSource()
 {
     $this->source = $this->model;
     // If specific collection not set then load all from table
     if (!isset($this->collection)) {
         $this->collection = $this->model->all();
     }
     return true;
 }
开发者ID:larablocks,项目名称:highway,代码行数:14,代码来源:EloquentReader.php

示例4: getAll

 /**
  * @param array $with
  * @throws \Symfony\Component\Process\Exception\InvalidArgumentException
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  * wrapper for eloquent all();
  */
 public function getAll($with = [])
 {
     if (isset($with) && !empty($with)) {
         if (!is_array($with)) {
             throw new InvalidArgumentException();
         }
         return $this->model->with($with)->get();
     }
     return $this->model->all();
 }
开发者ID:christiannwamba,项目名称:laravel-site,代码行数:16,代码来源:BaseRepository.php

示例5: listing

 public static function listing()
 {
     $fractal = new Manager();
     $data = new Collection(parent::all(), new GenreTransformer());
     $list = $fractal->createData($data)->toArray()['data'];
     return $list;
 }
开发者ID:nanaya,项目名称:osu-web,代码行数:7,代码来源:Genre.php

示例6: all

 /**
  * Get all of the models from the database.
  *
  * @param  array|mixed $columns
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public static function all($columns = ['*'])
 {
     if (func_num_args() === 0) {
         $columns = self::fields();
     }
     return parent::all($columns);
 }
开发者ID:wilcorrea,项目名称:awesovel,代码行数:13,代码来源:Model.php

示例7: all

 /**
  * @param array $columns
  *
  * @return mixed
  */
 public function all($columns = ['*'])
 {
     $this->eagerLoading();
     $this->applyCriteria();
     $results = $this->model->all($columns);
     $this->resetModel();
     return $this->parseResult($results);
 }
开发者ID:killtw,项目名称:repository,代码行数:13,代码来源:BaseRepository.php

示例8: all

 /**
  * Retrieve all data of repository
  *
  * @param array $columns
  * @return mixed
  */
 public function all($columns = array('*'))
 {
     $this->applyCriteria();
     if ($this->model instanceof \Illuminate\Database\Eloquent\Builder) {
         $results = $this->model->get($columns);
     } else {
         $results = $this->model->all($columns);
     }
     return $this->parserResult($results);
 }
开发者ID:osvaldino,项目名称:warehouse,代码行数:16,代码来源:BaseRepository.php

示例9: json

 /**
  * Retrieve all data of modal.
  *
  * @param array $columns
  *
  * @return mixed
  */
 public function json($columns = ['*'])
 {
     if ($this->model instanceof \Illuminate\Database\Eloquent\Builder) {
         $results = $this->model->get($columns)->toArray();
     } else {
         $results = $this->model->all($columns)->toArray();
     }
     $this->resetModel();
     return $results;
 }
开发者ID:Jastkast,项目名称:Page,代码行数:17,代码来源:BaseRepository.php

示例10: json

 /**
  * Retrieve all data of modal.
  *
  * @param array $columns
  *
  * @return mixed
  */
 public function json($columns = ['*'])
 {
     if ($this->userFilter) {
         $userId = User::users('id');
         $results = $this->model->whereUserId($userId)->all($columns)->toArray();
     } else {
         $results = $this->model->all($columns)->toArray();
     }
     $this->resetModel();
     return $results;
 }
开发者ID:LavaliteCms,项目名称:Example,代码行数:18,代码来源:BaseRepository.php

示例11: all

 /**
  * Retrieve all data of repository.
  *
  * @param array $columns
  *
  * @return mixed
  */
 public function all($columns = ['*'])
 {
     $this->applyCriteria();
     $this->applyScope();
     if ($this->model instanceof \Illuminate\Database\Eloquent\Builder) {
         $results = $this->model->get($columns);
     } else {
         $results = $this->model->all($columns);
     }
     $this->resetModel();
     return $this->parserResult($results);
 }
开发者ID:LavaLite,项目名称:framework,代码行数:19,代码来源:BaseRepository.php

示例12: get

 /**
  * @param array $columns
  * @return mixed
  */
 public function get($columns = ['*'])
 {
     $this->applyBoot();
     $this->applyScopes();
     $this->applyCriteria();
     if ($this->model instanceof Builder) {
         $results = $this->model->get($columns);
     } else {
         $results = $this->model->all($columns);
     }
     $this->cleanRepository();
     return $results;
 }
开发者ID:guilhermegonzaga,项目名称:repository,代码行数:17,代码来源:Repository.php

示例13: checkDataValueForModel

 /**
  * Apply mutators to the attribute "value" for a specific GEDCOM data table.
  *
  * @param Model $entity
  */
 private function checkDataValueForModel(Model $entity)
 {
     $this->info('Checking data values in table ' . $entity->getTable());
     $entity->all()->each(function ($item) {
         $old = $item->value;
         $item->value = $old;
         // Trigger the mutator
         if ($item->isDirty()) {
             $item->save();
             $this->info('Fixing: ' . $old . ' -> ' . $item->value);
         }
     });
 }
开发者ID:fisharebest,项目名称:webtrees-core,代码行数:18,代码来源:RepairDatabaseCommand.php

示例14: all

 /**
  * @param array $columns
  *
  * @return mixed
  */
 public function all($columns = ['*'], $isCount = false)
 {
     $this->eagerLoading();
     $this->applyCriteria();
     if ($isCount) {
         $results = $this->model->count();
     } else {
         $this->applyOrder();
         if ($this->model instanceof Builder) {
             $results = $this->model->get($columns);
         } else {
             $results = $this->model->all($columns);
         }
     }
     $this->resetModel();
     return $isCount ? $results : $this->parseResult($results);
 }
开发者ID:Ontoo-Inc,项目名称:Repository,代码行数:22,代码来源:BaseRepository.php

示例15: browse

 /**
  * List
  * 
  * @param  array  $options
  * @return array
  */
 public static function browse($options = [])
 {
     if (empty($options)) {
         return parent::all();
     }
     if (!empty($options['order'])) {
         foreach ($options['order'] as $field => $direction) {
             $find = parent::orderBy($field, $direction);
         }
     }
     if (!empty($options['limit'])) {
         $find = $find->take($options['limit']);
     }
     if (!empty($options['cursor'])) {
         $find = $find->where('id', '<', $options['cursor']);
     }
     return $find->get();
 }
开发者ID:emtudo,项目名称:laravel-shopping-cart,代码行数:24,代码来源:Product.php


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