all() public static method

Get all of the models from the database.
public static all ( array | mixed $columns = ['*'] ) : Illuminate\Database\Eloquent\Collection | static[]
$columns array | mixed
return Illuminate\Database\Eloquent\Collection | static[]
 /**
  * @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();
 }
 /**
  * Defer loading of Collection until needed
  * @return void
  */
 protected function boot()
 {
     if (!is_null($this->collection)) {
         return;
     }
     $this->collection = $this->model->all();
 }
 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'));
 }
Example #4
0
 /**
  * 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;
 }
Example #5
0
 public static function listing()
 {
     $fractal = new Manager();
     $data = new Collection(parent::all(), new GenreTransformer());
     $list = $fractal->createData($data)->toArray()['data'];
     return $list;
 }
Example #6
0
 /**
  * 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);
 }
Example #7
0
 /**
  * @param array $columns
  *
  * @return mixed
  */
 public function all($columns = ['*'])
 {
     $this->eagerLoading();
     $this->applyCriteria();
     $results = $this->model->all($columns);
     $this->resetModel();
     return $this->parseResult($results);
 }
Example #8
0
 /**
  * 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);
 }
Example #9
0
 /**
  * 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;
 }
Example #10
0
 /**
  * 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;
 }
Example #11
0
 /**
  * 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);
 }
 /**
  * @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;
 }
 /**
  * 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);
         }
     });
 }
Example #14
0
 /**
  * @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);
 }
Example #15
0
 /**
  * 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();
 }
Example #16
0
 /**
  * Get all Model from the DB
  *
  * @param array $columns
  * @return mixed
  */
 public function all(array $columns = ['*'])
 {
     return $this->model->all($columns);
 }
Example #17
0
 /**
  * Returns all records
  *
  * @param array $columns
  * @return array
  */
 public function all($columns = array("*"))
 {
     return $this->model->all($columns)->all();
 }
Example #18
0
 /**
  * {@inheritdoc}
  */
 public function all()
 {
     return $this->model->all()->pluck('value', 'key');
 }
Example #19
0
 /**
  * @return Collection
  */
 public function collection()
 {
     return $this->source->all();
 }
 public function findAll($columns = array('*'))
 {
     return $this->model->all();
 }
 /**
  * Gets all the projects
  * GET /api/v1/projects
  *
  * @return array
  */
 public function all()
 {
     $projects = $this->model->all();
     $output = $this->createJsonApiOutput($projects);
     return $output;
 }
Example #22
0
 /**
  * List all records in our table
  *
  * @return mixed
  */
 public function index()
 {
     $records = $this->modelInstance->all();
     return $records;
 }
 /**
  * Retorna todos os registros
  * @return bool|\Illuminate\Database\Eloquent\Collection|static[]
  */
 public function all()
 {
     $itens = $this->model->all();
     return count($itens) ? $itens : false;
 }
Example #24
0
 /**
  * 重写ALL方法,原生的ALL返回的为对象;重写后将返回array()
  * 
  * @param string|array $columns 参数
  * @return array 结果集
  */
 public static function all($columns = ['*'])
 {
     return parent::all(is_array($columns) ? $columns : func_get_args())->toArray();
 }
Example #25
0
 /**
  * All records
  * @return object  collection of object of model
  */
 public function all()
 {
     return $this->model->all();
 }
 /**
  * Get all languages .
  *
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public function getAll()
 {
     return $this->source->all();
 }