Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | 6 | public function toggleCustomerFavorite($custID, $userID) |
|
12 | { |
||
13 | 6 | $favData = CustomerFavs::where('cust_id', $custID)->where('user_id', $userID)->first(); |
|
14 | |||
15 | 6 | if($favData) |
|
16 | { |
||
17 | 4 | Log::info('Customer Favorite Removed. Data - ', ['user_id' => $userID, 'cust_id' => $custID]); |
|
18 | 4 | $favData->delete(); |
|
19 | 4 | return false; |
|
20 | } |
||
21 | |||
22 | 4 | Log::info('Customer Favorite Added. Data - ', ['user_id' => $userID, 'cust_id' => $custID]); |
|
23 | 4 | CustomerFavs::create([ |
|
24 | 4 | 'user_id' => $userID, |
|
25 | 4 | 'cust_id' => $custID, |
|
26 | ]); |
||
27 | 4 | return true; |
|
28 | } |
||
49 |