예제 #1
0
 /**
  * Used when having more than one where condition
  *
  * @param $respective_data
  *
  * @param bool|false $return_single
  *
  * @return array|mixed|null
  */
 public function Where($respective_data, $return_single = false)
 {
     $result = Capsule::table($this->TableName())->where($respective_data)->get();
     if ($return_single == true) {
         /**
          * Return result else null
          */
         return !empty($result) ? Query::Row($result) : null;
     }
     /**
      * Return full result else no
      */
     return !empty($result) ? Query::AllRows($result) : null;
 }
 /**
  * Runs a custom query.
  *
  * @param $query
  *
  * @param $equals
  *
  * @param bool|true $return_single
  *
  * @return array|mixed|null
  */
 public function Query($query, $equals, $return_single = true)
 {
     $result = Capsule::table($this->TableName())->where($query, $equals)->get();
     /**
      * If we are just returning a single array
      */
     if ($return_single == true) {
         /**
          * Return result else null
          */
         return !empty($result) ? Query::Row($result) : null;
     }
     /**
      * Return full result else no
      */
     return !empty($result) ? Query::AllRows($result) : null;
 }