This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { render, unmountComponentAtNode } from 'react-dom'; | |
const initApp = () => { | |
/* | |
* The target you want to display your app on | |
* eg <div id="my-app"> | |
*/ | |
const target = document.querySelector("#my-element"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"slim/slim": "2.6.2", | |
"smarty/smarty": "^3.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS `product` ( | |
`product_id` INT(11) NOT NULL AUTO_INCREMENT, | |
`name` VARCHAR(32) NOT NULL, | |
`description` TEXT NOT NULL, | |
`price` FLOAT(10,2) NOT NULL DEFAULT 0.00, | |
`category_id` INT(11) NOT NULL, | |
`date_upd` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
`date_add` DATETIME NOT NULL, | |
PRIMARY KEY (`product_id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT = 65; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO `product` (`product_id`, `name`, `description`, `price`, `category_id`, `date_upd`, `date_add`) VALUES | |
(1, 'LG P880 4X HD', 'My first awesome phone!', '336', 3, '2019-06-01 01:12:26', '2019-05-31 17:12:26'), | |
(2, 'Google Nexus 4', 'The most awesome phone of 2013!', '299', 2, '2019-06-01 01:12:26', '2019-05-31 17:12:26'), | |
(3, 'Samsung Galaxy S4', 'How about no?', '600', 3, '2019-06-01 01:12:26', '2019-05-31 17:12:26'), | |
(6, 'Bench Shirt', 'The best shirt!', '29', 1, '2019-06-01 01:12:26', '2019-05-31 02:12:21'), | |
(7, 'Lenovo Laptop', 'My business partner.', '399', 2, '2019-06-01 01:13:45', '2019-05-31 02:13:39'), | |
(8, 'Samsung Galaxy Tab 10.1', 'Good tablet.', '259', 2, '2019-06-01 01:14:13', '2019-05-31 02:14:08'), | |
(9, 'Spalding Watch', 'My sports watch.', '199', 1, '2019-06-01 01:18:36', '2019-05-31 02:18:31'), | |
(10, 'Sony Smart Watch', 'The coolest smart watch!', '300', 2, '2019-06-06 17:10:01', '2019-06-05 18:09:51'), | |
(11, 'Huawei Y300', 'For testing purposes.', '100', 2, '2019-06-06 17:11:04', '201 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS `category` ( | |
`category_id` INT(11) NOT NULL AUTO_INCREMENT, | |
`name` VARCHAR(255) NOT NULL, | |
`description` TEXT NOT NULL, | |
`date_upd` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
`date_add` DATETIME NOT NULL, | |
PRIMARY KEY (`category_id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=19; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO `category` (`category_id`, `name`, `description`, `date_upd`, `date_add`) VALUES | |
(1, 'Fashion', 'Category for anything related to fashion.', '2019-06-01 00:35:07', '2019-05-30 17:34:33'), | |
(2, 'Electronics', 'Gadgets, drones and more.', '2019-06-01 00:35:07', '2019-05-30 17:34:33'), | |
(3, 'Motors', 'Motor sports and more', '2019-06-01 00:35:07', '2019-05-30 17:34:54'), | |
(5, 'Movies', 'Movie products.', '0000-00-00 00:00:00', '2016-01-08 13:27:26'), | |
(6, 'Books', 'Kindle books, audio books and more.', '0000-00-00 00:00:00', '2016-01-08 13:27:47'), | |
(13, 'Sports', 'Drop into new winter gear.', '2016-01-09 02:24:24', '2016-01-09 01:24:24'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$config = array( | |
/** MySQL database name */ | |
'database_name' => 'rest_api', | |
/** MySQL hostname */ | |
'database_host' => 'localhost', | |
/** MySQL database username */ | |
'database_user' => 'root', | |
/** MySQL database password */ | |
'database_password' => 'password', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name" : "Amazing Pillow 2.0", | |
"price" : "199", | |
"description" : "The best pillow for amazing programmers.", | |
"category_id" : 2, | |
"created" : "2018-06-01 00:35:07" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function addProduct() { | |
$api = $this->api; | |
$payload = $api->request()->post(); | |
$name = ArrayUtils::get($payload, 'name'); | |
$description = ArrayUtils::get($payload, 'description'); | |
$price = ArrayUtils::get($payload, 'price'); | |
$category_id = ArrayUtils::get($payload, 'category_id'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace BestShop\v1; | |
use Db; | |
use BestShop\Route; | |
use BestShop\Database\DbQuery; | |
use BestShop\Product\Product as ProductObject; | |
use BestShop\Product\Category as CategoryObject; | |
use BestShop\Util\ArrayUtils; |