IPBlocker   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 9
c 1
b 0
f 0
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isBlocked() 0 7 2
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class IPBlocker extends Model
8
{
9
    protected $table = 'ipblockers';
10
11
    protected $fillable = [
12
        'ip_address',
13
        'status'
14
    ];
15
16
    /**
17
     * check ip address if is Blocked
18
     *
19
     * @return boolean
20
     */
21
    public static function isBlocked()
22
    {
23
        $obj = false;
24
        if(self::where(['ip_address' => \Request::ip(), 'status' => true])->count()) {
25
            $obj = true;
26
        }
27
        return $obj;
28
    }
29
}