master_template/app/Repositories/AdvertisementRepository.php

36 lines
898 B
PHP
Raw Normal View History

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