Completed
Push — develop ( 1eb861...f7494f )
by Neil
10s
created

ValidationServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 2 Features 0
Metric Value
wmc 2
c 3
b 2
f 0
lcom 0
cbo 1
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 14 1
A register() 0 4 1
1
<?php
2
/**
3
 * ValidationServiceProvider.php
4
 *
5
 * Custom validation rules
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
        // match the current password for the supplied user id
43
        Validator::extend(
44
            'password',
45
            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...
46
                return Auth::validate([
47
                    'user_id'  => $parameters[0],
48
                    'password' => $value,
49
                ]);
50
            },
51
            trans('passwords.current_password')
52
        );
53
    }
54
55
    /**
56
     * Register the service provider.
57
     *
58
     * @return void
59
     */
60
    public function register()
61
    {
62
        //
63
    }
64
}