Passed
Push — master ( 62919d...1f65fa )
by Iman
04:23
created

CbUsersRepo::table()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Crocodicstudio\Crudbooster\CBCoreModule;
4
5
class CbUsersRepo
6
{
7
    public function find($id)
8
    {
9
        return $this->where(['id' => $id])->first();
10
    }
11
12
    public function where($conditions)
13
    {
14
        return $this->table()->where($conditions);
15
    }
16
17
    public function table()
18
    {
19
        return \DB::table(cbConfig('USER_TABLE'));
20
    }
21
22
    public function findByMail($email)
23
    {
24
        return $this->where(['email' => $email])->first();
25
    }
26
27
    public function updateByMail($email, $data)
28
    {
29
        return $this->where(['email' => $email])->update($data);
30
    }
31
32
    public function insert($data)
33
    {
34
        return $this->table()->insert($data);
35
    }
36
}