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

AdminOnlyRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 4 1
A rules() 0 4 1
1
<?php
2
/**
3
 * AdminOnlyRequest.php
4
 *
5
 * Only allow admin users, no validation is done
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\Http\Requests;
27
28
use Auth;
29
30
class AdminOnlyRequest extends Request
31
{
32
    /**
33
     * Determine if the user is authorized to make this request.
34
     *
35
     * @return bool
36
     */
37
    public function authorize()
38
    {
39
        return Auth::user()->isAdmin();
40
    }
41
42
    /**
43
     * Get the validation rules that apply to the request.
44
     *
45
     * @return array
46
     */
47
    public function rules()
48
    {
49
        return [];
50
    }
51
}
52