Completed
Push — master ( 29a90d...0e040f )
by Mike
03:08
created

CachePrefixing::getConnectionName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php namespace GeneaLabs\LaravelModelCaching\Traits;
2
3
trait CachePrefixing
4
{
5
    protected function getCachePrefix() : string
6
    {
7
        return "genealabs:laravel-model-caching:"
8
            . $this->getConnectionName() . ":"
9
            . $this->getDatabaseName() . ":"
10
            . (config("laravel-model-caching.cache-prefix")
11
                ? config("laravel-model-caching.cache-prefix", "") . ":"
12
                : "");
13
    }
14
15
    protected function getDatabaseName() : string
16
    {
17
        return $this->query->connection->getDatabaseName();
18
    }
19
20
    protected function getConnectionName() : string
21
    {
22
        return $this->model->getConnection()->getName();
23
    }
24
}
25