AbstractModel   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getNamespace() 0 4 1
A getCount() 0 5 1
1
<?php
2
3
namespace Taskforcedev\LaravelForum\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * Class AbstractModel
9
 * Extends Illuminate\Database\Eloquent\Model
10
 *
11
 * @package Taskforcedev\LaravelForum\Models
12
 */
13
class AbstractModel extends Model
14
{
15
    use \Illuminate\Console\AppNamespaceDetectorTrait;
16
17
    public function getNamespace()
18
    {
19
        return $this->getAppNamespace();
20
    }
21
22
    /**
23
     * Helper method to get the count of items from a table.
24
     */
25
    public function getCount()
26
    {
27
        $count = \DB::select('select COUNT(*) as `count` from ' . $this->table);
28
        return $count[0]->count;
29
    }
30
}
31