Passed
Push — master ( 816a06...aeb70e )
by Iman
04:44
created

ModulesRepo::modulePathExists()   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 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace crocodicstudio\crudbooster\Modules\ModuleGenerator;
4
5
use Illuminate\Support\Facades\DB;
6
7
class ModulesRepo
8
{
9
    public static function getControllerName($moduleId)
10
    {
11
        return self::find($moduleId)->controller;
12
    }
13
14
    public static function find($id)
15
    {
16
        return DB::table('cms_moduls')->where('id', $id)->first();
17
    }
18
19
    public static function getByTableName($table)
20
    {
21
        return DB::table('cms_moduls')->where('table_name', $table)->first();
22
    }
23
24
    /**
25
     * @param $path
26
     * @return mixed
27
     */
28
    public static function modulePathExists($path)
29
    {
30
        return (boolean)DB::table('cms_moduls')->where('path', $path)->where('deleted_at', null)->count();
31
    }
32
33
    public static function updateById($id, $data)
34
    {
35
        return DB::table('cms_moduls')->where('id', $id)->update($data);
36
    }
37
38
    public static function getByPath($modulepath)
39
    {
40
        return DB::table('cms_moduls')->where('path', $modulepath)->first();
41
42
43
    }
44
    public static function countByPath($modulepath)
45
    {
46
        return DB::table('cms_moduls')->where('path', $modulepath)->count();
47
    }
48
49
50
}