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;
|
||||
}
|
||||
}
|
||||
22
models/Places.php
Normal file
22
models/Places.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Places extends Model {
|
||||
protected $table = 'places';
|
||||
|
||||
public static function getName($data) {
|
||||
$places = Places::where('id', $data)->first();
|
||||
if ($places) {
|
||||
$place_name = $places['name'];
|
||||
} else {
|
||||
$place_name = 'Связанный зал не найден';
|
||||
|
||||
}
|
||||
return $place_name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
24
models/Reasons.php
Normal file
24
models/Reasons.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Reasons extends Model {
|
||||
protected $table = 'reasons';
|
||||
|
||||
public static function getName($data) {
|
||||
$reason_name = Reasons::where('code', intval($data))->where('is_history', 0)->first();
|
||||
if ($reason_name) {
|
||||
$reason_name = $reason_name['name'];
|
||||
} else {
|
||||
$reason_name = Reasons::where('code', intval($data))->where('is_history', 1)->first();
|
||||
if ($reason_name) {
|
||||
$reason_name = $reason_name['name'];
|
||||
} else {
|
||||
$reason_name = 'Связанная причина удаления не найдена';
|
||||
}
|
||||
}
|
||||
return $reason_name;
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,19 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Staff extends Model {
|
||||
protected $table = 'staffs';
|
||||
|
||||
public static function getName($data) {
|
||||
$staff_name = Staff::where('code', intval($data))->where('is_history', 0)->first();
|
||||
if ($staff_name) {
|
||||
$staff_name = $staff_name['name'];
|
||||
} else {
|
||||
$staff_name = Staff::where('code', intval($data))->where('is_history', 1)->first();
|
||||
if ($staff_name) {
|
||||
$staff_name = $staff_name['name'];
|
||||
} else {
|
||||
$staff_name = 'Связанный персонал не найден';
|
||||
}
|
||||
}
|
||||
return $staff_name;
|
||||
}
|
||||
}
|
||||
19
models/StaffRights.php
Normal file
19
models/StaffRights.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StaffRights extends Model {
|
||||
protected $table = 'staff_rights';
|
||||
|
||||
public static function add($code, $name) {
|
||||
if (StaffRights::where('code', $code)->count() == 0) {
|
||||
$staffRight = new StaffRights([
|
||||
'code' => $code,
|
||||
'name' => $name,
|
||||
]);
|
||||
$staffRight->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
22
models/Tables.php
Normal file
22
models/Tables.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Component\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Tables extends Model
|
||||
{
|
||||
protected $table = 'place_tables';
|
||||
|
||||
public static function getName($id)
|
||||
{
|
||||
$table = Tables::where('id', $id)->first();
|
||||
if ($table) {
|
||||
$table_name = $table['name'];
|
||||
} else {
|
||||
|
||||
$table_name = 'Связанный стол не найден';
|
||||
}
|
||||
return $table_name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user