VisitorRequest::visitor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * VisitorRequest.php
5
 *
6
 * This model contains information about requests visitors make
7
 * on your website. This model is linked by a hasMany on the Visitor model.
8
 * Every VisitorRequest has one unique visitor record represented by the belongsTo
9
 * visitor relation.
10
 *
11
 * PHP version 7.2
12
 *
13
 * @category Models
14
 * @package  RedboxTracker
15
 * @author   Johnny Mast <[email protected]>
16
 * @license  https://opensource.org/licenses/MIT MIT
17
 * @link     https://github.com/johnnymast/redbox-tracker
18
 * @since    GIT:1.0
19
 */
20
21
namespace Redbox\Tracker;
22
23
use Illuminate\Database\Eloquent\Relations\BelongsTo;
24
use Illuminate\Database\Eloquent\Model;
25
26
/**
27
 * VisitorRequest class
28
 *
29
 * Model for website visitor requests.
30
 *
31
 * @category Models
32
 * @package  RedboxTracker
33
 * @author   Johnny Mast <[email protected]>
34
 * @license  https://opensource.org/licenses/MIT MIT
35
 * @link     https://github.com/johnnymast/redbox-tracker
36
 * @since    GIT:1.0
37
 */
38
class VisitorRequest extends Model
39
{
40
    /**
41
     * The attributes that are mass assignable.
42
     *
43
     * @var array
44
     */
45
    protected $fillable = [
46
      'unique_id',
47
      'domain',
48
      'method',
49
      'path',
50
      'route',
51
      'referer',
52
      'is_secure',
53
      'is_ajax'
54
    ];
55
    
56
    /**
57
     * Return the visitor for this request.
58
     *
59
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
60
     */
61
    public function visitor(): BelongsTo
62
    {
63
        return $this->belongsTo(Visitor::class);
64
    }
65
}
66