| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- // app/Models/LoginModel.php
- namespace App\Models;
-
- use Config\Database;
-
- class LoginModel
- {
- /**
- * 로그인 타입에 맞는 쿼리 빌더를 반환합니다.
- * @param string $loginType ('vendor' or 'influence')
- * @return \CodeIgniter\Database\BaseBuilder
- */
- public function getBuilderFor(string $loginType)
- {
- $db = Database::connect();
- $tableName = '';
-
- switch ($loginType) {
- case 'vendor':
- $tableName = 'VENDOR_LIST';
- break;
- case 'influence':
- $tableName = 'USER_LIST';
- break;
- case 'brand':
- $tableName = 'BRAND_LIST';
- break;
- default:
- throw new \InvalidArgumentException("Invalid login type provided: " . $loginType);
- }
-
- return $db->table($tableName);
- }
- }
|