155. public function __construct(array $config = [])
156. {
157. $this->defaultConfig = Config::default('ZN\Database\DatabaseDefaultConfiguration')
158. ::get('Database', 'database');
159. $this->config = array_merge($this->defaultConfig, $config);
160. $this->db = $this->runDriver();
161. $this->prefix = $this->config['prefix'];
162. Properties::$prefix = $this->prefix;
163.
164. $this->db->connect($this->config);
165. }
166.
167. /**
168. * Magic Debug Info
169. */
170. public function __debugInfo()
171. {
172. return ['return' => $this->stringQuery ?: 'This is a general object, please call the sub method!'];
173. }
174.
53. // Sluga göre çekim
54. public function getBySlug($slug){
55. $sor = DB::where([
56. ["status", 1, "and"],
57. ['slug_en', $slug, "or"],
58. ['slug_ar', $slug, "or"],
59. ['slug_ru', $slug, "or"],
60. ['slug_es', $slug, "or"],
61. ['slug_fr', $slug, "or"],
62. ['slug_tr', $slug],
63. ])->products()->row();
64.
65. return $sor;
66. }
67.
68. // Product width category
69. public function producttWidthCategory(){
70.
71. return DB::where('products.status', 1)
72. ->select('products.productID, products.name_tr, products.slug_tr, category.slug_tr as c_tr, products.marka, category.slug_en as c_en, products.slug_en, products.name_en, products.name_ar, category.catName_tr, category.catName_en, category.catName_ar, products.resim')
41. * protected use class name
42. *
43. * @param string $method
44. * @param array $parameters
45. *
46. * @return mixed
47. */
48. protected static function useClassName($method, $parameters)
49. {
50. return Singleton::class(INTERNAL_ACCESS . static::getClassName())->$method(...$parameters);
51. }
52. }
15. * Magic call static
16. *
17. * @param string $method
18. * @param array $parameters
19. *
20. * @return mixed
21. */
22. public static function __callStatic($method, $parameters)
23. {
24. return self::useClassName($method, $parameters);
25. }
26.
27. /**
28. * Magic call
29. *
30. * @param string $method
31. * @param array $parameters
32. *
33. * @return mixed
34. */
96.
97.
98. public function productsingle($slug = null){
99.
100.
101.
102. // $slug = URI::get(ML::select('urun_url'));
103.
104. $slug = URI::segment(-1);
105. $sor = ProductModel::getBySlug($slug);
106.
107. if(!$sor) {
108. redirect(URL::site('404'));
109. }
110.
111.
112. $seo_title = "seo_title_".Lang::get();
113. $seo_key = "seo_key_".Lang::get();
114. $seo_desc= "seo_desc_".Lang::get();
115. $baslik= "name_".Lang::get();
145. // @codeCoverageIgnoreEnd
146. else
147. {
148. $this->connect = new MySQLi($host, $user, $pass, $db, $port);
149. }
150. restore_error_handler();
151.
152. if( $this->connect->connect_errno )
153. {
154. throw new ConnectionErrorException(NULL, $this->connect->connect_error); // @codeCoverageIgnore
155. }
156.
157. mysqli_report(MYSQLI_REPORT_OFF);
158.
159. if( ! empty($this->config['charset'] ) ) $this->query("SET NAMES '".$this->config['charset']."'");
160. if( ! empty($this->config['charset'] ) ) $this->query('SET CHARACTER SET '.$this->config['charset']);
161. if( ! empty($this->config['collation']) ) $this->query('SET COLLATION_CONNECTION = "'.$this->config['collation'].'"');
162. }
163.
164. /**