Completed
Push — master ( 02e9e6...9b3fc3 )
by ARCANEDEV
09:52
created

FooterFormRequest::getPageRule()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
ccs 0
cts 7
cp 0
cc 2
eloc 5
nc 2
nop 0
crap 6
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
     * Get the page validation rule.
20
     *
21
     * @return array
22
     */
23
    protected function getPageRule()
24
    {
25
        $existsRule = Rule::exists($this->getTablePrefix().'pages', 'id');
26
27
        if ($this->has('locale'))
28
            $existsRule = $existsRule->where('locale', $this->get('locale', config('app.locale')));
29
30
        return ['required', 'integer', $existsRule];
31
    }
32
33
    /**
34
     * Get unique URI Rule.
35
     *
36
     * @return \Illuminate\Validation\Rules\Unique
37
     */
38
    protected function getUniqueUriRule()
39
    {
40
        return Rule::unique($this->getTablePrefix().'footers', 'uri');
41
    }
42
}
43