Completed
Pull Request — master (#12)
by Adam
04:47 queued 01:24
created

EloquentTrait::model()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 2
1
<?php
2
3
namespace BestServedCold\LaravelZendSearch\Laravel;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * Class EloquentTrait
9
 * @package BestServedCold\LaravelZendSearch\Laravel
10
 */
11
trait EloquentTrait
12
{
13
    /**
14
     * @var string $key
15
     */
16
    protected $key = 'id';
17
18
    /**
19
     * @var Model $model
20
     */
21
    protected $model;
22
23
    /**
24
     * @var string $uid
25
     */
26
    protected $uid;
27
28
    /**
29
     * @param Model $model
30
     * @return $this
31
     */
32
    public function model(Model $model)
33
    {
34
        $this->model = $model;
35
        $this->key = $model->getKeyName();
36
        $this->uid = $model->getTable();
37
        return $this;
38
    }
39
}
40