Ejemplo n.º 1
0
 /**
  * Execute the query as a "select" statement.
  *
  * @param  array                                             $columns
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public function get($columns = array('*'))
 {
     if ($this->is_collection) {
         $this->query->setModel(new Collection(array('table_name' => $this->name)));
     } elseif ($this->query instanceof \Illuminate\Database\Query\Builder) {
         $this->query->from($this->name);
     }
     // Check 'read' access before running the query.
     // - for 'owner' role each entry need to be checked on results.
     $role = Role::getInstance()->getConfig($this->name, 'read');
     if ($role !== 'owner' && !Role::isAllowed($this->name, 'read')) {
         throw new ForbiddenException();
     }
     return $this->__call('get', func_get_args());
 }