krgm.so-manager-dev.com/app/Services/UserService.php
Your Name 71986a2df1
All checks were successful
Deploy preview (main_go) / deploy (push) Successful in 14s
feat: 实装SHJ-6/9/10バッチ処理システム
- SHJ-9: 日次売上集計処理
- SHJ-10: 年次月次売上集計処理
- SHJ-6: サーバ死活監視処理
- 各種モデルサービスコマンド追加
- earnings_summary, device, hardware_check_log, print_job_log テーブル用SQL追加
2025-08-22 19:44:06 +09:00

58 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Services;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
/**
* 利用者取得サービス
* - 旧テーブル互換のまま、画面用の取得口を一本化する
*/
class UserService
{
/**
* ユーザーSEQで1件取得旧互換
*/
public function findBySeq(int $userSeq): ?object
{
return \App\Legacy\User::find($userSeq);
}
/**
* 画面検索条件でページング旧User::searchの最小互換
*/
public function paginate(array $inputs): LengthAwarePaginator
{
$query = \App\Legacy\User::query();
if (!empty($inputs['user_id'])) {
$query->where('user_id', 'like', '%'.$inputs['user_id'].'%');
}
if (!empty($inputs['member_id'])) {
$query->where('member_id', 'like', '%'.$inputs['member_id'].'%');
}
if (!empty($inputs['user_tag_serial'])) {
$query->where('user_tag_serial', 'like', '%'.$inputs['user_tag_serial'].'%');
}
if (!empty($inputs['user_phonetic'])) {
$query->where('user_phonetic', 'like', '%'.$inputs['user_phonetic'].'%');
}
if (!empty($inputs['phone'])) {
$phone = $inputs['phone'];
$query->where(function ($q) use ($phone) {
$q->where('user_mobile', 'like', '%'.$phone.'%')
->orWhere('user_homephone', 'like', '%'.$phone.'%');
});
}
$sort = $inputs['sort'] ?? 'user_seq';
$dir = $inputs['sort_type'] ?? 'desc';
return $query->orderBy($sort, $dir)->paginate(\App\Utils::item_per_page);
}
}