|
|
@ -29,7 +29,7 @@ class UserFavController extends Controller |
|
|
|
|
|
|
|
|
public function create() |
|
|
public function create() |
|
|
{ |
|
|
{ |
|
|
$id = (int)request()->input('id'); |
|
|
|
|
|
|
|
|
$id = (int)request()->input('agent_product_id'); |
|
|
|
|
|
|
|
|
$agent_product = AgentProduct::find($id); |
|
|
$agent_product = AgentProduct::find($id); |
|
|
if (!$agent_product) { |
|
|
if (!$agent_product) { |
|
|
@ -48,9 +48,13 @@ class UserFavController extends Controller |
|
|
|
|
|
|
|
|
public function delete() |
|
|
public function delete() |
|
|
{ |
|
|
{ |
|
|
$id = (int)request()->input('id'); |
|
|
|
|
|
|
|
|
$id = (int)request()->input('agent_product_id'); |
|
|
|
|
|
|
|
|
UserFav::where('user_id', $this->user_id)->find($id)->delete(); |
|
|
|
|
|
|
|
|
$fav = UserFav::query()->where(['user_id' => $this->user_id, 'agent_product_id' => $id])->first(); |
|
|
|
|
|
if (!$fav) { |
|
|
|
|
|
return $this->error('收藏不存在'); |
|
|
|
|
|
} |
|
|
|
|
|
$fav->delete(); |
|
|
return $this->success(); |
|
|
return $this->success(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |