Passed
Push — master ( 707992...a76c69 )
by Iman
03:43
created

CbUsersRepo   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A where() 0 3 1
A find() 0 3 1
A updateByMail() 0 3 1
A findByMail() 0 3 1
A table() 0 3 1
A insert() 0 3 1
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
}