Completed
Pull Request — develop (#124)
by Tony
03:14
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 Auth;
30
use Illuminate\Support\ServiceProvider;
31
use Validator;
32
33
class ValidationServiceProvider extends ServiceProvider
34
{
35
    /**
36
     * Bootstrap any application services.
37
     *
38
     * @return void
39
     */
40
    public function boot()
41
    {
42
        Validator::extend(
43
            'password',
44
            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...
45
                return Auth::validate([
46
                    'user_id'  => $parameters[0],
47
                    'password' => $value,
48
                ]);
49
            },
50
            trans('passwords.current_password')
51
        );
52
    }
53
54
    /**
55
     * Register the service provider.
56
     *
57
     * @return void
58
     */
59
    public function register()
60
    {
61
        //
62
    }
63
}