From cdae11b7805ca791a02feea9fdb82a2832325000 Mon Sep 17 00:00:00 2001 From: Andrey Pokidov Date: Mon, 30 Mar 2020 19:27:07 +0700 Subject: [PATCH] +ContentRequest --- src/Forms/ContentForm.php | 2 +- src/Requests/ContentRequest.php | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/Requests/ContentRequest.php diff --git a/src/Forms/ContentForm.php b/src/Forms/ContentForm.php index 5e2e85d..0d78ca3 100644 --- a/src/Forms/ContentForm.php +++ b/src/Forms/ContentForm.php @@ -9,7 +9,7 @@ use Artmark\Content\Models\Content; /** * Description of ContentForm * - * @author Andrey Pokidov + * @author Andrey Pokidov */ class ContentForm extends Form { diff --git a/src/Requests/ContentRequest.php b/src/Requests/ContentRequest.php new file mode 100644 index 0000000..d75fff8 --- /dev/null +++ b/src/Requests/ContentRequest.php @@ -0,0 +1,32 @@ + + */ +class ContentRequest extends FormRequest +{ + /** + * Merges rules + * @param array $extraRules + * @return array + */ + public function appendContentRules(array $extraRules) + { + $contentRules = [ + 'title' => 'required|string|max:' . Content::MAXIMAL_TITLE_LENGTH, + 'keywords' => 'string', + 'description' => 'string', + 'body' => 'string', + ]; + + return array_merge($contentRules, $extraRules); + } +}