This commit is contained in:
tanch0
2024-06-15 22:23:54 +05:45
parent 8253440371
commit cb99bedac6
144 changed files with 6436 additions and 3112 deletions

View File

@ -0,0 +1,35 @@
<?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);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Repositories;
use App\Repositories\Interface\AuthorsInterface;
use App\Models\Authors;
class AuthorRepository implements AuthorsInterface
{
public function getAll()
{
return Authors::where('status', '<>', -1)->orderBy('display_order')->get();
}
public function getAuthorsById($authorId)
{
return Authors::findOrFail($authorId);
}
public function delete($authorId)
{
return Authors::destroy($authorId);
}
public function create(array $authorDetail)
{
return Authors::create($authorDetail);
}
public function update($authorId, array $newDetails)
{
return Authors::where('author_id', $authorId)->update($newDetails);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Repositories;
use App\Models\Economies;
use App\Repositories\Interface\EconomyInterface;
class EconomyRepository implements EconomyInterface
{
public function getAll()
{
return Economies::where('status','<>', -1)->orderBy('display_order')->get();
}
public function getId($id)
{
return Economies::findOrFail($id);
}
public function delete($id)
{
return Economies::destroy($id);
}
public function create(array $Details)
{
return Economies::create($Details);
}
public function update($id, array $newDetails){
return Economies::where('economy_id', $id)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Repositories\Interface;
interface AdvertisementInterface
{
public function getAll();
public function getAdvertisementById($id);
public function delete($advertisementId);
public function create(array $advertisementDetail);
public function update($advertisementId, array $newDetails);
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Repositories\Interface;
interface AuthorsInterface
{
public function getAll();
public function getAuthorsById($authorId);
public function delete($authorId);
public function create(array $authorDetail);
public function update($authorId, array $newDetails);
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Repositories\Interface;
interface EconomyInterface
{
public function getAll();
public function getId($id);
public function delete($id);
public function create(array $Details);
public function update($id, array $newDetails);
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Repositories\Interface;
interface NewsCategoriesInterface
{
public function getAll();
public function getNewsCategoriesById($newsCategoriesId);
public function delete($newsCategoriesId);
public function create(array $newsCategoriesDetail);
public function update($newsCategoriesId, array $newDetails);
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Repositories\Interface;
interface NewsInterface
{
public function getAll();
public function getNewsById($newsId);
public function delete($newsId);
public function create(array $newsDetail);
public function update($newsId, array $newDetails);
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Repositories\Interface;
interface NewsTypeInterface
{
public function getAll();
public function getNewsTypeById($newsTypeId);
public function delete($newsTypeId);
public function create(array $newsTypeDetail);
public function update($newsTypeId, array $newDetails);
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Repositories\Interface;
interface ProvinceInterface
{
public function getAll();
public function getProvinceById($provinceId);
public function delete($provinceId);
public function create(array $provinceDetails);
public function update($provinceId, array $newDetails);
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Repositories;
use App\Models\Newscategories;
use App\Repositories\Interface\NewsCategoriesInterface;
class NewsCategoriesRepository implements NewsCategoriesInterface
{
public function getAll()
{
return Newscategories::where('status', '<>', -1)->orderBy('display_order')->get();
}
public function getNewsCategoriesById($newsCategoriesId)
{
return Newscategories::findOrFail($newsCategoriesId);
}
public function delete($newsCategoriesId)
{
return Newscategories::destroy($newsCategoriesId);
}
public function create(array $provinceDetails)
{
return Newscategories::create($provinceDetails);
}
public function update($newsCategoriesId, array $newDetails)
{
return Newscategories::where('category_id', $newsCategoriesId)->update($newDetails);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Repositories;
use App\Models\News;
use App\Repositories\Interface\NewsInterface;
class NewsRepository implements NewsInterface
{
public function getAll()
{
return News::where('status', '<>', -1)->orderBy('display_order')->get();
}
public function getNewsById($newsId)
{
return News::findOrFail($newsId);
}
public function delete($newsId)
{
return News::destroy($newsId);
}
public function create(array $newsDetail)
{
return News::create($newsDetail);
}
public function update($newsId, array $newDetails)
{
return News::where('news_id', $newsId)->update($newDetails);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Repositories;
use App\Models\News_type;
use App\Repositories\Interface\NewsTypeInterface;
class NewsTypeRepository implements NewsTypeInterface
{
public function getAll()
{
return News_type::where('status','<>', -1)->orderBy('display_order')->get();
}
public function getNewsTypeById($newsTypeId)
{
return News_type::findOrFail($newsTypeId);
}
public function delete($newsTypeId)
{
return News_type::destroy($newsTypeId);
}
public function create(array $newsTypeDetail)
{
return News_type::create($newsTypeDetail);
}
public function update($newsTypeId, array $newDetails){
return News_type::where('news_type_id', $newsTypeId)->update($newDetails);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Repositories;
use App\Models\Provinces;
use App\Repositories\Interface\ProvinceInterface;
class ProvinceRepository implements ProvinceInterface
{
public function getAll()
{
return Provinces::where('status','<>', -1)->orderBy('display_order')->get();
}
public function getProvinceById($provinceId)
{
return Provinces::findOrFail($provinceId);
}
public function delete($provinceId)
{
return Provinces::destroy($provinceId);
}
public function create(array $provinceDetails)
{
return Provinces::create($provinceDetails);
}
public function update($provinceId, array $newDetails){
return Provinces::where('province_id', $provinceId)->update($newDetails);
}
}