BaseModel   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTable() 0 4 1
A joiningTable() 0 4 1
1
<?php
2
3
namespace Oscer\Cms\Core\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Support\Str;
7
8
abstract class BaseModel extends Model
9
{
10
    protected $guarded = [];
11
12
    /**
13
     * Get the table associated with the model.
14
     *
15
     * @return string
16
     */
17
    public function getTable()
18
    {
19
        return $this->table ?? 'cms_'.Str::snake(Str::pluralStudly(class_basename($this)));
20
    }
21
22
    /**
23
     * Get the joining table name for a many-to-many relation.
24
     *
25
     * @param  string  $related
26
     * @param  \Illuminate\Database\Eloquent\Model|null  $instance
27
     * @return string
28
     */
29
    public function joiningTable($related, $instance = null)
30
    {
31
        return 'cms_'.parent::joiningTable($related, $instance);
32
    }
33
}
34