Редактор карты зала
Электронные заказы
Отчет по удалениям
This commit is contained in:
miroman-afk
2022-09-22 16:34:02 +03:00
parent 1af2b267f5
commit dcd0e72d1f
43 changed files with 2481 additions and 727 deletions

View File

@@ -12,4 +12,35 @@ class Dishes extends Model {
* @var array
*/
protected $guarded = [];
public static function getName($data) {
$dish_name = Dishes::where('code', $data)->where('is_history', 0)->first();
if ($dish_name) {
$dish_name = $dish_name['name'];
} else {
$dish_name = Dishes::where('code', $data)->where('is_history', 1)->first();
if ($dish_name) {
$dish_name = $dish_name['name'];
} else {
$dish_name = 'Связанный товар удален';
}
}
return $dish_name;
}
public static function isReal($data) {
$dish_isReal = Dishes::where('code', $data)->where('is_history', 0)->first();
$isReal = 0;
if ($dish_isReal) {
$isReal = intval($dish_isReal['real_count']);
} else {
$dish_isReal = Dishes::where('code', $data)->where('is_history', 1)->first();
if ($dish_isReal) {
$isReal = intval($dish_isReal['real_count']);
} else {
$isReal = 0;
}
}
return $isReal;
}
}