v.2.22
Редактор карты зала Электронные заказы Отчет по удалениям
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user