(Guillermo) Create path /ticket/create

This commit is contained in:
AntonyAntonio 2016-06-21 00:19:44 -03:00
parent 9295554dd1
commit 839265e852
2 changed files with 8 additions and 4 deletions

View File

@ -31,16 +31,16 @@ class CreateController extends Controller {
private function validateData() {
if (strlen($this->title) < 3) {
return 'title is too short';
Response::respondError(ERRORS::SHORT_TITLE);
}
if (strlen($this->title) > 30) {
return 'title is very long';
Response::respondError(ERRORS::LONG_TITLE);
}
if (strlen($this->content) < 5) {
return 'content is too short';
Response::respondError(ERRORS::SHORT_CONTENT);
}
if (strlen($this->content) > 500) {
return 'content is very long';
Response::respondError(ERRORS::LONG_CONTENT);
}
return true;

View File

@ -2,4 +2,8 @@
class ERRORS {
const INVALID_CREDENTIALS = 'User or password is not defined';
const SESSION_EXISTS = 'User is already logged in';
const SHORT_TITLE = 'Title is too short';
const LONG_TITLE = 'Title is very long';
const SHORT_CONTENT = 'Content is too short';
const LONG_CONTENT = 'Content is very long';
}