cms-frontend/app/Services/Api/ContentService.php

80 lines
2.0 KiB
PHP

<?php
namespace App\Services\Api;
class ContentService extends BaseApiService
{
// Promotions
public function getAllPromotions(array $params = [])
{
return $this->get('/promotions', $params);
}
public function createPromotion(array $data)
{
return $this->post('/promotions', $data, true); // true for image upload
}
public function updatePromotion($id, array $data)
{
return $this->post("/promotions/{$id}", array_merge($data, ['_method' => 'PUT']), true);
}
public function deletePromotion($id)
{
return $this->post("/promotions/{$id}", ['_method' => 'DELETE']);
}
// Notifications
public function getAllNotifications(array $params = [])
{
return $this->get('/notifications', $params);
}
public function createNotification(array $data)
{
return $this->post('/notifications', $data);
}
public function updateNotification($id, array $data)
{
return $this->post("/notifications/{$id}", array_merge($data, ['_method' => 'PUT']));
}
public function deleteNotification($id)
{
return $this->post("/notifications/{$id}", ['_method' => 'DELETE']);
}
// Photo Slider
public function getAllSlides(array $params = [])
{
return $this->get('/photo-slider', $params);
}
public function createSlide(array $data)
{
return $this->post('/photo-slider', $data, true); // true for image upload
}
public function updateSlide($id, array $data)
{
return $this->post("/photo-slider/{$id}", array_merge($data, ['_method' => 'PUT']), true);
}
public function deleteSlide($id)
{
return $this->post("/photo-slider/{$id}", ['_method' => 'DELETE']);
}
// Terms and Privacy
public function getTermsAndPrivacy()
{
return $this->get('/terms-and-privacy');
}
public function updateTermsAndPrivacy(array $data)
{
return $this->post('/terms-and-privacy', $data);
}
}