restaurant changes
This commit is contained in:
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');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user