where('id', $id)->value('number'); } public static function getId($number) { return self::query()->where('number', 'like', "%{$number}%")->pluck( 'id' )->toArray(); } public static function getValueId($number) { return self::query()->where('number', $number)->value('id'); } public static function getCount() { return self::query()->count(); } public static function getAll() { return self::query()->orderBy('created_at', 'desc')->select( ['id', 'number'] )->get()->toArray(); } public static function getFloorData() { return self::query()->orderBy('created_at', 'desc')->select( ['id', 'number', 'floor_id'] )->get()->each(function ($item) { $item['floor'] = AdminFloor::getName($item['floor_id']); unset($item['floor_id']); return $item; })->toArray(); } public static function getModeFloorCount($floor_id, $spaceIds, $status = '11', $type = '') { $model = self::query(); $model->where('floor_id', $floor_id); $model->whereIn('id', $spaceIds); if ($status == '11') { $model->whereIn('status', [0, 1]); } else { $model->where('status', $status); } if ($type) { $model->where('space_type_id', $type); } return $model->count(); } public static function getFloorCount($floor_id) { return self::query()->where('floor_id', $floor_id)->count(); } }