1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace App\Http\Dao;
use App\Models\Order;
class OrderDao extends Order
{
/**
* 查找订单号的单条记录
* @param array $where
* @return mixed
*/
public function getFirstRecord(array $where)
{
return Order::where($where)
->first();
}
/**
* 查找订单号的单条记录
* @param array $where
* @return mixed
*/
public function getFirstRecordByStr(string $where)
{
return Order::where($where)
->first();
}
/**
* 插入单条记录
*
* @param array $data
* @return mixed
*/
public function insertData(array $data)
{
return self::insert($data);
}
/**
* 通过id进行记录更新
*
* @param int $id
* @param array $updateData
* @return mixed
*/
public function updateById(int $id, array $updateData)
{
return self::where('id', $id)->update($updateData);
}
}