Completed
Push — master ( 8d2fdf...2555d1 )
by ARCANEDEV
14:00
created

FooterFormRequest::getValidatedInputs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 6
cp 0
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php namespace Arcanesoft\Seo\Http\Requests\Admin\Footers;
2
3
use Arcanesoft\Seo\Http\Requests\Admin\FormRequest;
4
use Illuminate\Validation\Rule;
5
6
/**
7
 * Class     FooterFormRequest
8
 *
9
 * @package  Arcanesoft\Seo\Http\Requests\Admin\Footers
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
abstract class FooterFormRequest extends FormRequest
13
{
14
    /* -----------------------------------------------------------------
15
     |  Other Methods
16
     | -----------------------------------------------------------------
17
     */
18
19
    /**
20
     * Get the validated inputs.
21
     *
22
     * @return array
23
     */
24
    public function getValidatedInputs()
25
    {
26
        return $this->only([
27
            // Footer inputs
28
            'name', 'localization', 'uri', 'locale', 'page',
29
            // SEO Metas inputs
30
            'seo_title', 'seo_description', 'seo_keywords',
31
        ]);
32
    }
33
34
    /**
35
     * Get the page validation rule.
36
     *
37
     * @return array
38
     */
39
    protected function getPageRule()
40
    {
41
        $existsRule = Rule::exists($this->getTablePrefix().'pages', 'id');
42
43
        if ($this->has('locale'))
44
            $existsRule = $existsRule->where('locale', $this->get('locale', config('app.locale')));
45
46
        return ['required', 'integer', $existsRule];
47
    }
48
49
    /**
50
     * Get unique URI Rule.
51
     *
52
     * @return \Illuminate\Validation\Rules\Unique
53
     */
54
    protected function getUniqueUriRule()
55
    {
56
        return Rule::unique($this->getTablePrefix().'footers', 'uri');
57
    }
58
}
59