/** * Returns information from the database based on the table. Can return a singular row. * * @param $array * * @param null $row * * @return null */ public function Where($array, $row = null) { $result = Capsule::table($this->active_table)->where($array)->get(); /** * If we are not empty */ if (empty($result) == false) { if ($row != null) { if (is_int($row) == false) { return null; } return CherryPick::PickRow($result, $row); } return CherryPick::QueryToArray($result); } /** * Return null if so. */ return null; }
/** * Gets all the songs by an artist. * * @param $artist * * @return null */ public function GetArtist($artist) { $result = $this->database->Where(["artist" => $artist]); if (empty($result) == true) { return null; } return CherryPick::QueryToArray($result); }
/** * Gets the publisher of this album. * * @param $publisher * * @return null */ public function GetPublisher($publisher) { $result = $this->database->Where(["publisher" => $publisher]); if (empty($result) == true) { return null; } return CherryPick::QueryToArray($result); }