Completed
Push — master ( 1fb91c...78f962 )
by Anton
03:04 queued 56s
created

Query   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A statement() 0 3 1
A request() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of Laravel Sense.
5
 *
6
 * (c) Anton Komarev <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cog\Laravel\Sense\Db\Query\Models;
15
16
use Cog\Laravel\Sense\Request\Models\Request;
17
use Cog\Laravel\Sense\Statement\Models\Statement;
18
use Illuminate\Database\Eloquent\Model;
19
use Illuminate\Database\Eloquent\Relations\BelongsTo;
20
21
class Query extends Model
22
{
23
    protected $connection = 'sense';
24
25
    protected $table = 'sense_request_db_queries';
26
27
    protected $fillable = [
28
        'statement_id',
29
        'connection',
30
        'sql',
31
        'bindings',
32
        'time',
33
    ];
34
35
    protected $casts = [
36
        'bindings' => 'json',
37
    ];
38
39
    public function request(): BelongsTo
40
    {
41
        return $this->belongsTo(Request::class, 'request_id');
42
    }
43
44
    public function statement(): BelongsTo
45
    {
46
        return $this->belongsTo(Statement::class, 'statement_id');
47
    }
48
}
49