Files
sam-manage/app/Models/Barobill/Client.php
김보곤 072268a1cf feat:계좌 입출금내역 거래처코드 검색 기능 추가
- Client 모델 생성 (거래처 검색용)
- EaccountController에 searchClients API 추가
- save/parseTransactionLogs/convertManualToLogs/convertDbToRawLog에 client_code/client_name 필드 추가
- ClientCodeSelect 컴포넌트 추가 (서버 검색 기반 debounce 드롭다운)
- 테이블에 거래처코드 컬럼 추가
- BankTransaction 모델 fillable에 client_code/client_name 추가
- 라우트에 clients/search 엔드포인트 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 21:18:31 +09:00

32 lines
887 B
PHP

<?php
namespace App\Models\Barobill;
use Illuminate\Database\Eloquent\Model;
/**
* 거래처 모델 (검색용)
* clients 테이블은 API 프로젝트에서 관리하며, MNG에서는 검색 조회만 수행
*/
class Client extends Model
{
protected $table = 'clients';
/**
* 거래처코드 또는 거래처명으로 검색
*/
public static function searchByCodeOrName(int $tenantId, string $keyword, int $limit = 20)
{
return self::where('tenant_id', $tenantId)
->where('is_active', true)
->where(function ($query) use ($keyword) {
$query->where('client_code', 'like', "%{$keyword}%")
->orWhere('name', 'like', "%{$keyword}%");
})
->select('client_code', 'name')
->orderBy('client_code')
->limit($limit)
->get();
}
}