Esempio n. 1
0
 /**
  * @param        $column
  * @param        $comparator
  * @param        $value
  * @param null   $function
  * @param string $table
  *
  * @return $this
  */
 public function where($column, $comparator, $value, $function = null, $table = 'self')
 {
     if ($column === 'publication_id') {
         $table = 'publications_authors';
         $this->join($table, 'author_id', '=', 'id');
     }
     parent::where($column, $comparator, $value, $function, $table);
     return $this;
 }
Esempio n. 2
0
 /**
  * @param        $column
  * @param        $comparator
  * @param        $value
  * @param null   $function
  * @param string $table
  *
  * @return $this
  */
 public function where($column, $comparator, $value, $function = null, $table = 'self')
 {
     if ($column === 'user_id') {
         $table = 'users_roles';
         $this->join($table, 'role_id', '=', 'id');
     }
     parent::where($column, $comparator, $value, $function, $table);
     return $this;
 }
Esempio n. 3
0
 /**
  * @param        $column
  * @param        $comparator
  * @param        $value
  * @param null   $function
  * @param string $table
  *
  * @return $this
  */
 public function where($column, $comparator, $value, $function = null, $table = 'self')
 {
     if ($column === 'role_id') {
         $table = 'roles_permissions';
         $this->join .= ' LEFT JOIN `roles_permissions` ON (`roles_permissions`.`permission_id` = self.`id`)';
     } else {
         if ($column === 'user_id') {
             $this->select = 'SELECT DISTINCT self.*';
             $table = 'users_roles';
             $this->join .= ' LEFT JOIN `roles_permissions` ON (`roles_permissions`.`permission_id` = self.`id`)';
             $this->join .= ' LEFT JOIN `users_roles` ON (`users_roles`.`role_id` = `roles_permissions`.`role_id`)';
         }
     }
     parent::where($column, $comparator, $value, $function, $table);
     return $this;
 }
Esempio n. 4
0
 /**
  * @param        $column
  * @param        $comparator
  * @param        $value
  * @param null   $function
  * @param string $table
  *
  * @return $this
  */
 public function where($column, $comparator, $value, $function = null, $table = 'self')
 {
     if ($column === 'author_id') {
         $table = 'publications_authors';
         $this->join($table, 'publication_id', '=', 'id');
     } else {
         if ($column === 'keyword_id') {
             $table = 'publications_keywords';
             $this->join($table, 'publication_id', '=', 'id');
         } else {
             if ($column === 'keyword_name') {
                 $this->join('publications_keywords', 'publication_id', '=', 'id');
                 $this->join .= ' JOIN `keywords` ON (`publications_keywords`.`keyword_id` = `keywords`.`id`)';
                 $table = 'keywords';
                 $column = 'name';
             }
         }
     }
     parent::where($column, $comparator, $value, $function, $table);
     return $this;
 }
Esempio n. 5
0
 /**
  * Add the field to query to find the model
  *
  * @param Repository $repository
  *
  * @return Repository
  */
 public function whereRepository($repository)
 {
     return $repository->where($this->getSchema()->getColumn(), $this->getValueRaw());
 }