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
|
|
|
|