|
@@ -15,7 +15,8 @@ use Longyi\Gift\Http\Resources\CustomCartResource;
|
|
|
class GiftController extends Controller
|
|
class GiftController extends Controller
|
|
|
{
|
|
{
|
|
|
public function __construct(
|
|
public function __construct(
|
|
|
- protected GiftCardsRepository $giftCardRepository
|
|
|
|
|
|
|
+ protected GiftCardsRepository $giftCardRepository,
|
|
|
|
|
+ protected GiftCards $giftCardsModel
|
|
|
) {
|
|
) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -27,7 +28,7 @@ class GiftController extends Controller
|
|
|
|
|
|
|
|
public function lists(): JsonResponse
|
|
public function lists(): JsonResponse
|
|
|
{
|
|
{
|
|
|
- $gifts = $this->giftCardRepository->giftcards();
|
|
|
|
|
|
|
+ $gifts = $this->giftCardsModel->giftcards();
|
|
|
return response()->json([
|
|
return response()->json([
|
|
|
'success' => true,
|
|
'success' => true,
|
|
|
'data' => $gifts,
|
|
'data' => $gifts,
|
|
@@ -37,7 +38,7 @@ class GiftController extends Controller
|
|
|
public function add($request): JsonResponse
|
|
public function add($request): JsonResponse
|
|
|
{
|
|
{
|
|
|
$id = $request->input('id');
|
|
$id = $request->input('id');
|
|
|
- $success = $this->giftCardRepository->add($id);
|
|
|
|
|
|
|
+ $success = $this->giftCardsModel->add($id);
|
|
|
return response()->json([
|
|
return response()->json([
|
|
|
'success' => $success,
|
|
'success' => $success,
|
|
|
'message' => $success ? 'Gift card added successfully' : 'Failed to add gift card',
|
|
'message' => $success ? 'Gift card added successfully' : 'Failed to add gift card',
|