master_template/app/Repositories/AdvertisementRepository.php

36 lines
894 B
PHP
Raw Normal View History

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