From ac30717ef4f52a285843c7f21a31397cd2f25a7e Mon Sep 17 00:00:00 2001 From: dvaganov Date: Wed, 25 May 2016 16:20:04 +0300 Subject: [PATCH] Add table orders and create related model --- data/notes.sql | 45 ++++++++++++++++++++++++++++++++++++++ models/Orders.php | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 data/notes.sql create mode 100644 models/Orders.php diff --git a/data/notes.sql b/data/notes.sql new file mode 100644 index 0000000..276170b --- /dev/null +++ b/data/notes.sql @@ -0,0 +1,45 @@ +-- MySQL dump 10.13 Distrib 5.7.12, for Linux (x86_64) +-- +-- Host: localhost Database: notes +-- ------------------------------------------------------ +-- Server version 5.5.5-10.1.14-MariaDB + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `orders` +-- + +DROP TABLE IF EXISTS `orders`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `orders` ( + `id` int(11) NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `address` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `phone` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `date_create` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2016-05-25 16:09:26 diff --git a/models/Orders.php b/models/Orders.php new file mode 100644 index 0000000..3775c55 --- /dev/null +++ b/models/Orders.php @@ -0,0 +1,55 @@ + 255], + [['phone'], 'string', 'max' => 10], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'name' => 'Name', + 'address' => 'Address', + 'email' => 'Email', + 'phone' => 'Phone', + 'date_create' => 'Date Create', + ]; + } +}