master_template/app/Repositories/AdvertisementRepository.php
2024-06-15 22:23:54 +05:45

36 lines
898 B
PHP

<?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);
}
}