Completed
Pull Request — develop (#124)
by Tony
03:58 queued 15s
created

AdminOnlyRequest::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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