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

FooterFormRequest::getUniqueUriRule()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 4
cp 0
cc 1
eloc 2
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
     * 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