a grand renaming so that the most significant portion of the name comes first
This commit is contained in:
16
php-practice/web-cake/html/app/models/blog-init.sql
Normal file
16
php-practice/web-cake/html/app/models/blog-init.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
/* First, create our posts table: */
|
||||
CREATE TABLE posts (
|
||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
title VARCHAR(50),
|
||||
body TEXT,
|
||||
created DATETIME DEFAULT NULL,
|
||||
modified DATETIME DEFAULT NULL
|
||||
);
|
||||
|
||||
/* Then insert some posts for testing: */
|
||||
INSERT INTO posts (title,body,created)
|
||||
VALUES ('The title', 'This is the post body.', NOW());
|
||||
INSERT INTO posts (title,body,created)
|
||||
VALUES ('A title once again', 'And the post body follows.', NOW());
|
||||
INSERT INTO posts (title,body,created)
|
||||
VALUES ('Title strikes back', 'This is really exciting! Not.', NOW());
|
15
php-practice/web-cake/html/app/models/post.php
Normal file
15
php-practice/web-cake/html/app/models/post.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class Post extends AppModel {
|
||||
public $name = "Post";
|
||||
public $validate = array(
|
||||
"title" => array(
|
||||
"rule" => "notEmpty"
|
||||
),
|
||||
"body" => array(
|
||||
"rule" => "notEmpty"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user