1 | <?php namespace Arcanesoft\Blog\Http\Requests\Admin\Posts; |
||
15 | abstract class PostRequest extends FormRequest |
||
16 | { |
||
17 | /* ----------------------------------------------------------------- |
||
18 | | Main Methods |
||
19 | | ----------------------------------------------------------------- |
||
20 | */ |
||
21 | |||
22 | /** |
||
23 | * Get the validation rules that apply to the request. |
||
24 | * |
||
25 | * @return array |
||
26 | */ |
||
27 | public function rules() |
||
40 | |||
41 | /* ----------------------------------------------------------------- |
||
42 | | Other Methods |
||
43 | | ----------------------------------------------------------------- |
||
44 | */ |
||
45 | |||
46 | /** |
||
47 | * Get the validated inputs. |
||
48 | * |
||
49 | * @return array |
||
50 | */ |
||
51 | public function getValidatedData() |
||
52 | { |
||
53 | return array_merge([ |
||
54 | 'author_id' => $this->user()->getAuthIdentifier(), |
||
55 | 'category_id' => $this->get('category') |
||
56 | ], $this->only([ |
||
57 | // POST inputs |
||
58 | 'title', 'excerpt', 'content', 'tags', 'published_at', 'status', |
||
59 | |||
60 | // SEO inputs |
||
61 | 'seo_title', 'seo_description', 'seo_keywords', |
||
62 | ])); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Get the slug rule. |
||
67 | * |
||
68 | * @param string $column |
||
69 | * |
||
70 | * @return \Illuminate\Validation\Rules\Unique |
||
71 | */ |
||
72 | protected static function getSlugRule($column = 'slug') |
||
78 | |||
79 | /** |
||
80 | * Get the category rule. |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | protected static function getCategoryRule() |
||
88 | |||
89 | /** |
||
90 | * Get the tags rule. |
||
91 | * |
||
92 | * @return array |
||
93 | */ |
||
94 | protected static function getTagsRule() |
||
98 | |||
99 | /** |
||
100 | * Get the post status rule. |
||
101 | * |
||
102 | * @return array |
||
103 | */ |
||
104 | protected static function getPostStatusRule() |
||
108 | } |
||
109 |