restaurant changes

This commit is contained in:
Sampanna Rimal
2024-09-19 18:33:08 +05:45
parent 0b438e302d
commit 2fa9d47a73
115 changed files with 3489 additions and 67 deletions

View 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();
}

View File

@ -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');
}
}

View 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();
}

View 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');
}
}

View 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();
}

View 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');
}
}