changes
This commit is contained in:
15
Modules/Product/app/Repositories/FabricCategoryInterface.php
Normal file
15
Modules/Product/app/Repositories/FabricCategoryInterface.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Repositories;
|
||||
|
||||
interface FabricCategoryInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getFabricCategoryById($FabricCategoryId);
|
||||
public function getFabricCategoryByEmail($email);
|
||||
public function delete($FabricCategoryId);
|
||||
public function create($FabricCategoryDetails);
|
||||
public function update($FabricCategoryId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Repositories;
|
||||
|
||||
use Modules\Product\Models\FabricCategory;
|
||||
|
||||
class FabricCategoryRepository implements FabricCategoryInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return FabricCategory::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getFabricCategoryById($FabricCategoryId)
|
||||
{
|
||||
return FabricCategory::findOrFail($FabricCategoryId);
|
||||
}
|
||||
|
||||
public function getFabricCategoryByEmail($email)
|
||||
{
|
||||
return FabricCategory::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($FabricCategoryId)
|
||||
{
|
||||
FabricCategory::destroy($FabricCategoryId);
|
||||
}
|
||||
|
||||
public function create($FabricCategoryDetails)
|
||||
{
|
||||
return FabricCategory::create($FabricCategoryDetails);
|
||||
}
|
||||
|
||||
public function update($FabricCategoryId, array $newDetails)
|
||||
{
|
||||
return FabricCategory::whereId($FabricCategoryId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return FabricCategory::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
@@ -44,3 +44,4 @@ class ProductRepository implements ProductInterface
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user