Passed
Push — master ( 51edae...d29a9b )
by Curtis
11:52 queued 05:54
created

RoleTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A query() 0 6 1
A templatePath() 0 3 1
1
<?php
2
3
namespace App\Tables\Builders\enso\Roles;
4
5
use Illuminate\Database\Eloquent\Builder;
6
use App\Models\enso\Roles\Role;
7
use LaravelEnso\Tables\Contracts\Table;
8
9
class RoleTable implements Table
10
{
11
    protected const TemplatPath = __DIR__.'/../../../Templates/enso/roles/roles.json';
12
13
    public function query(): Builder
14
    {
15
        return Role::selectRaw('
0 ignored issues
show
Bug Best Practice introduced by
The expression return App\Models\enso\R...u_id', '=', 'menus.id') could return the type Illuminate\Database\Query\Builder which is incompatible with the type-hinted return Illuminate\Database\Eloquent\Builder. Consider adding an additional type-check to rule them out.
Loading history...
16
            roles.id, roles.name, roles.display_name, roles.description,
17
            roles.created_at, menus.name as defaultMenu
18
        ')->leftJoin('menus', 'roles.menu_id', '=', 'menus.id');
19
    }
20
21
    public function templatePath(): string
22
    {
23
        return static::TemplatPath;
24
    }
25
}
26