IPBlocker::isBlocked()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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