Issues (413)

app/Http/Requests/AdminPermissionUpdateRequest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Yeelight\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Validation\Rule;
7
8
/**
9
 * Class AdminPermissionUpdateRequest
10
 *
11
 * @category Yeelight
12
 *
13
 * @package Yeelight\Http\Requests
14
 *
15
 * @author Sheldon Lee <[email protected]>
16
 *
17
 * @license https://opensource.org/licenses/MIT MIT
18
 *
19
 * @link https://www.yeelight.com
20
 */
21
class AdminPermissionUpdateRequest extends FormRequest
22
{
23
    /**
24
     * Get the URL to redirect to on a validation error.
25
     *
26
     * @return string
27
     */
28
    protected function getRedirectUrl()
29
    {
30
        return $this->getSession()->previousUrl();
0 ignored issues
show
The method previousUrl() does not exist on Symfony\Component\HttpFo...ession\SessionInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        return $this->getSession()->/** @scrutinizer ignore-call */ previousUrl();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
31
    }
32
33
    /**
34
     * Determine if the user is authorized to make this request.
35
     *
36
     * @return bool
37
     */
38
    public function authorize()
39
    {
40
        return true;
41
    }
42
43
    /**
44
     * Get the validation rules that apply to the request.
45
     *
46
     * @return array
47
     */
48
    public function rules()
49
    {
50
        return [
51
            'slug'  => 'required|max:50',
52
            'name'  => [
53
                'required',
54
                Rule::unique('admin_permissions')->ignore($this->name, 'name'),
55
                'max:50',
56
            ],
57
            'http_method' => 'array',
58
            'http_path'   => 'required',
59
        ];
60
    }
61
}
62