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