當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。