restaurant changes
This commit is contained in:
0
Modules/Ingredient/app/Repositories/.gitkeep
Normal file
0
Modules/Ingredient/app/Repositories/.gitkeep
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
interface IngredientCategoryInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getIngredientCategoryById($IngredientCategoryId);
|
||||
public function getIngredientCategoryByEmail($email);
|
||||
public function delete($IngredientCategoryId);
|
||||
public function create($IngredientCategoryDetails);
|
||||
public function update($IngredientCategoryId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
use Modules\Ingredient\Models\IngredientCategory;
|
||||
|
||||
class IngredientCategoryRepository implements IngredientCategoryInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return IngredientCategory::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getIngredientCategoryById($IngredientCategoryId)
|
||||
{
|
||||
return IngredientCategory::findOrFail($IngredientCategoryId);
|
||||
}
|
||||
|
||||
public function getIngredientCategoryByEmail($email)
|
||||
{
|
||||
return IngredientCategory::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($IngredientCategoryId)
|
||||
{
|
||||
IngredientCategory::destroy($IngredientCategoryId);
|
||||
}
|
||||
|
||||
public function create($IngredientCategoryDetails)
|
||||
{
|
||||
return IngredientCategory::create($IngredientCategoryDetails);
|
||||
}
|
||||
|
||||
public function update($IngredientCategoryId, array $newDetails)
|
||||
{
|
||||
return IngredientCategory::whereId($IngredientCategoryId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return IngredientCategory::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
16
Modules/Ingredient/app/Repositories/IngredientInterface.php
Normal file
16
Modules/Ingredient/app/Repositories/IngredientInterface.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
interface IngredientInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getIngredientById($IngredientId);
|
||||
public function getIngredientByEmail($email);
|
||||
public function getIngredientsByCategory($categoryId);
|
||||
public function delete($IngredientId);
|
||||
public function create($IngredientDetails);
|
||||
public function update($IngredientId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
52
Modules/Ingredient/app/Repositories/IngredientRepository.php
Normal file
52
Modules/Ingredient/app/Repositories/IngredientRepository.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
use Modules\Ingredient\Models\Ingredient;
|
||||
|
||||
class IngredientRepository implements IngredientInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Ingredient::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getIngredientById($IngredientId)
|
||||
{
|
||||
return Ingredient::findOrFail($IngredientId);
|
||||
}
|
||||
|
||||
public function getIngredientByEmail($email)
|
||||
{
|
||||
return Ingredient::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function getIngredientsByCategory($ingredientCategoryId)
|
||||
{
|
||||
return Ingredient::where('ingredient_category_id', $ingredientCategoryId)->pluck('name', 'id');
|
||||
}
|
||||
|
||||
public function delete($IngredientId)
|
||||
{
|
||||
Ingredient::destroy($IngredientId);
|
||||
}
|
||||
|
||||
public function create($IngredientDetails)
|
||||
{
|
||||
return Ingredient::create($IngredientDetails);
|
||||
}
|
||||
|
||||
public function update($IngredientId, array $newDetails)
|
||||
{
|
||||
return Ingredient::whereId($IngredientId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Ingredient::pluck('name', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
|
15
Modules/Ingredient/app/Repositories/UnitInterface.php
Normal file
15
Modules/Ingredient/app/Repositories/UnitInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
interface UnitInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getUnitById($UnitId);
|
||||
public function getUnitByEmail($email);
|
||||
public function delete($UnitId);
|
||||
public function create($UnitDetails);
|
||||
public function update($UnitId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
46
Modules/Ingredient/app/Repositories/UnitRepository.php
Normal file
46
Modules/Ingredient/app/Repositories/UnitRepository.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
use Modules\Ingredient\Models\Unit;
|
||||
|
||||
class UnitRepository implements UnitInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Unit::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getUnitById($UnitId)
|
||||
{
|
||||
return Unit::findOrFail($UnitId);
|
||||
}
|
||||
|
||||
public function getUnitByEmail($email)
|
||||
{
|
||||
return Unit::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($UnitId)
|
||||
{
|
||||
Unit::destroy($UnitId);
|
||||
}
|
||||
|
||||
public function create($UnitDetails)
|
||||
{
|
||||
return Unit::create($UnitDetails);
|
||||
}
|
||||
|
||||
public function update($UnitId, array $newDetails)
|
||||
{
|
||||
return Unit::whereId($UnitId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Unit::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user