master_template/app/Repositories/AdvertisementRepository.php

36 lines
904 B
PHP
Raw Normal View History

2024-06-15 16:38:54 +00:00
<?php
namespace App\Repositories;
2024-06-18 10:41:58 +00:00
use App\Models\Advertisements;
2024-06-15 16:38:54 +00:00
use App\Repositories\Interface\AdvertisementInterface;
class AdvertisementRepository implements AdvertisementInterface
{
public function getAll()
{
2024-06-18 10:41:58 +00:00
return Advertisements::where('status', '<>', -1)->orderBy('display_order')->get();
2024-06-15 16:38:54 +00:00
}
public function getAdvertisementById($advertisementId)
{
2024-06-18 10:41:58 +00:00
return Advertisements::where('advertisement_id', $advertisementId)->first();
2024-06-15 16:38:54 +00:00
}
public function delete($advertisementId)
{
2024-06-18 10:41:58 +00:00
return Advertisements::where('advertisement_id', $advertisementId)->delete();
2024-06-15 16:38:54 +00:00
}
public function create(array $newData)
{
2024-06-18 10:41:58 +00:00
return Advertisements::create($newData);
2024-06-15 16:38:54 +00:00
}
public function update($advertisementId, array $newDetails)
{
2024-06-18 10:41:58 +00:00
return Advertisements::where('advertisement_id', $advertisementId)->update($newDetails);
2024-06-15 16:38:54 +00:00
}
}