Completed
Pull Request — develop (#124)
by Tony
03:18
created

ValidationServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
/**
3
 * ValidationServiceProvider.php
4
 *
5
 * -Description-
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 *
20
 * @package    LibreNMS
21
 * @link       http://librenms.org
22
 * @copyright  2016 Tony Murray
23
 * @author     Tony Murray <[email protected]>
24
 */
25
26
namespace App\Providers;
27
28
29
use Illuminate\Support\ServiceProvider;
30
use Validator;
31
32
class ValidationServiceProvider extends ServiceProvider
33
{
34
    /**
35
     * Bootstrap any application services.
36
     *
37
     * @return void
38
     */
39
    public function boot()
40
    {
41
        Validator::extend(
42
            'password',
43
            function($attribute, $value, $parameters, $validator) {
0 ignored issues
show
Unused Code introduced by
The parameter $validator is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
44
                return auth()->validate([
0 ignored issues
show
Bug introduced by
The method validate() does not seem to exist on object<Illuminate\Contracts\Auth\Factory>.

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...
45
                    'user_id'  => $parameters[0],
46
                    'password' => $value,
47
                ]);
48
            },
49
            trans('passwords.current_password')
50
        );
51
    }
52
53
    /**
54
     * Register the service provider.
55
     *
56
     * @return void
57
     */
58
    public function register()
59
    {
60
        //
61
    }
62
}