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

CbUsersRepo::findByMail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
nc 1
nop 1
dl 0
loc 3
c 0
b 0
f 0
cc 1
rs 10
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
}