Conditions | 2 |
Paths | 2 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
47 | 4 | public function updateCustomerFav($custID) |
|
48 | { |
||
49 | 4 | $favData = CustomerFavs::where('cust_id', $custID)->where('user_id', $this->userID)->first(); |
|
50 | |||
51 | 4 | if($favData) |
|
52 | { |
||
53 | 2 | Log::info('Customer Bookmark removed. Detais', [ |
|
54 | 2 | 'user_id' => $this->userID, |
|
55 | 2 | 'cust_id' => $custID, |
|
56 | ]); |
||
57 | 2 | $favData->delete(); |
|
58 | } |
||
59 | else |
||
60 | { |
||
61 | 4 | CustomerFavs::create([ |
|
62 | 4 | 'user_id' => $this->userID, |
|
63 | 4 | 'cust_id' => $custID, |
|
64 | ]); |
||
65 | 4 | Log::info('Customer Bookmark added. Detais', [ |
|
66 | 4 | 'user_id' => $this->userID, |
|
67 | 4 | 'cust_id' => $custID, |
|
68 | ]); |
||
69 | } |
||
70 | |||
71 | 4 | return true; |
|
72 | } |
||
74 |