Skip to content

Commit a575944

Browse files
caothu159portal-bot
andcommitted
refactor: document simba model layers (#217)
* refactor(simba): document model layers and align imports * fix(simba): avoid company code as generic primary key * fix(simba): record composite primary key columns * refactor(simba): drop legacy non-Model SModel classes * docs: merge model layer plans * feat(simba): add direct models for generated schema --------- Co-authored-by: portal-bot <bot@portal>
1 parent a42cd02 commit a575944

789 files changed

Lines changed: 13417 additions & 379 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ DB_CONNECTION_SIMBA=... (nếu dùng connection riêng)
5353
Sử dụng model:
5454

5555
```php
56-
use Diepxuan\Simba\SModel\InDmVt;
56+
use Diepxuan\Simba\SModel\InDmVtModel;
5757

58-
$items = InDmVt::all();
58+
$items = InDmVtModel::all();
5959
```
6060

6161
Sử dụng stored procedure caller:
@@ -81,35 +81,11 @@ laravel-simba/
8181
├── config/
8282
│ └── config.php # Cấu hình package (connection)
8383
├── src/
84-
│ ├── SModel/ # Các model Simba (bảng dữ liệu)
84+
│ ├── SModel/ # Raw/table schema của SimbaERP (1:1 với bảng vật lý)
8585
│ │ ├── SModel.php (base)
86-
│ │ ├── SysLanguage.php
87-
│ │ ├── InCT3.php
88-
│ │ ├── SoPh3.php
89-
│ │ ├── GlDmTk.php
90-
│ │ ├── GlCt.php
91-
│ │ ├── GlCdTk.php
92-
│ │ ├── SysCompany.php
93-
│ │ ├── SysCompanyResx.php
94-
│ │ ├── InDmVt.php
95-
│ │ ├── InPH3.php
96-
│ │ ├── SiSetup.php
97-
│ │ ├── SysUserCompanyRight.php
98-
│ │ ├── ArDmKh.php
99-
│ │ ├── InDmKho.php
100-
│ │ ├── SysUserInfo.php
101-
│ │ └── InDmNhvt.php
102-
│ ├── Models/ # Các model mở rộng (có thể thêm scope)
103-
│ │ ├── SysCompany.php
104-
│ │ ├── SysUserCompanyRight.php
105-
│ │ ├── InDmVt.php
106-
│ │ ├── InDmKho.php
107-
│ │ ├── SysUserInfo.php
108-
│ │ ├── ArDmKh.php
109-
│ │ ├── SoPh3.php
110-
│ │ ├── InDmNhvt.php
111-
│ │ ├── SiSetup.php
112-
│ │ └── GlCt.php
86+
│ │ └── *Model.php # Mỗi file tương ứng một bảng, tên theo chuẩn <Table>Model
87+
│ ├── Models/ # Model Simba có behavior/query helper trực tiếp dùng trong code
88+
│ │ └── <Table>.php # Extend từ <Table>Model tương ứng ở SModel
11389
│ ├── StoredProcedures/ # Các class gọi stored procedure
11490
│ │ ├── ProcedureCaller.php
11591
│ │ ├── AsGetSoCt.php

src/Models/ApCt1.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Diepxuan\Simba\Models;
1515

16+
use Diepxuan\Simba\Models\Concerns\HasSimbaCompositeKey;
1617
use Diepxuan\Simba\SModel\ApCt1Model as Model;
1718
use Illuminate\Database\Eloquent\Builder;
1819
use Illuminate\Support\Collection;
@@ -25,6 +26,8 @@
2526
*/
2627
class ApCt1 extends Model
2728
{
29+
use HasSimbaCompositeKey;
30+
2831
/** Filter theo mã công ty */
2932
public function scopeFilterByMaCty(Builder $query, ?string $maCty): Builder
3033
{

src/Models/ApCt3.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* @copyright © 2019 Dxvn, Inc.
7+
*
8+
* @author Tran Ngoc Duc <ductn@diepxuan.com>
9+
*
10+
* @lastupdate 2026-06-21
11+
*/
12+
13+
namespace Diepxuan\Simba\Models;
14+
15+
use Diepxuan\Simba\Models\Concerns\HasSimbaCompositeKey;
16+
use Diepxuan\Simba\SModel\ApCt3Model;
17+
18+
/**
19+
* Model ApCt3.
20+
*
21+
* Lớp Simba model trực tiếp cho bảng `ApCt3`, kế thừa schema từ `ApCt3Model`.
22+
*/
23+
class ApCt3 extends ApCt3Model
24+
{
25+
use HasSimbaCompositeKey;
26+
27+
}

src/Models/ApCt4.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* @copyright © 2019 Dxvn, Inc.
7+
*
8+
* @author Tran Ngoc Duc <ductn@diepxuan.com>
9+
*
10+
* @lastupdate 2026-06-21
11+
*/
12+
13+
namespace Diepxuan\Simba\Models;
14+
15+
use Diepxuan\Simba\Models\Concerns\HasSimbaCompositeKey;
16+
use Diepxuan\Simba\SModel\ApCt4Model;
17+
18+
/**
19+
* Model ApCt4.
20+
*
21+
* Lớp Simba model trực tiếp cho bảng `ApCt4`, kế thừa schema từ `ApCt4Model`.
22+
*/
23+
class ApCt4 extends ApCt4Model
24+
{
25+
use HasSimbaCompositeKey;
26+
27+
}

src/Models/ApPh1.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* @copyright © 2019 Dxvn, Inc.
7+
*
8+
* @author Tran Ngoc Duc <ductn@diepxuan.com>
9+
*
10+
* @lastupdate 2026-06-21
11+
*/
12+
13+
namespace Diepxuan\Simba\Models;
14+
15+
use Diepxuan\Simba\Models\Concerns\HasSimbaCompositeKey;
16+
use Diepxuan\Simba\SModel\ApPh1Model;
17+
18+
/**
19+
* Model ApPh1.
20+
*
21+
* Lớp Simba model trực tiếp cho bảng `ApPh1`, kế thừa schema từ `ApPh1Model`.
22+
*/
23+
class ApPh1 extends ApPh1Model
24+
{
25+
use HasSimbaCompositeKey;
26+
27+
}

src/Models/ApPh3.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* @copyright © 2019 Dxvn, Inc.
7+
*
8+
* @author Tran Ngoc Duc <ductn@diepxuan.com>
9+
*
10+
* @lastupdate 2026-06-21
11+
*/
12+
13+
namespace Diepxuan\Simba\Models;
14+
15+
use Diepxuan\Simba\Models\Concerns\HasSimbaCompositeKey;
16+
use Diepxuan\Simba\SModel\ApPh3Model;
17+
18+
/**
19+
* Model ApPh3.
20+
*
21+
* Lớp Simba model trực tiếp cho bảng `ApPh3`, kế thừa schema từ `ApPh3Model`.
22+
*/
23+
class ApPh3 extends ApPh3Model
24+
{
25+
use HasSimbaCompositeKey;
26+
27+
}

src/Models/ApPh4.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* @copyright © 2019 Dxvn, Inc.
7+
*
8+
* @author Tran Ngoc Duc <ductn@diepxuan.com>
9+
*
10+
* @lastupdate 2026-06-21
11+
*/
12+
13+
namespace Diepxuan\Simba\Models;
14+
15+
use Diepxuan\Simba\Models\Concerns\HasSimbaCompositeKey;
16+
use Diepxuan\Simba\SModel\ApPh4Model;
17+
18+
/**
19+
* Model ApPh4.
20+
*
21+
* Lớp Simba model trực tiếp cho bảng `ApPh4`, kế thừa schema từ `ApPh4Model`.
22+
*/
23+
class ApPh4 extends ApPh4Model
24+
{
25+
use HasSimbaCompositeKey;
26+
27+
}

src/Models/ApTt.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* @copyright © 2019 Dxvn, Inc.
7+
*
8+
* @author Tran Ngoc Duc <ductn@diepxuan.com>
9+
*
10+
* @lastupdate 2026-06-21
11+
*/
12+
13+
namespace Diepxuan\Simba\Models;
14+
15+
use Diepxuan\Simba\Models\Concerns\HasSimbaCompositeKey;
16+
use Diepxuan\Simba\SModel\ApTtModel;
17+
18+
/**
19+
* Model ApTt.
20+
*
21+
* Lớp Simba model trực tiếp cho bảng `ApTt`, kế thừa schema từ `ApTtModel`.
22+
*/
23+
class ApTt extends ApTtModel
24+
{
25+
use HasSimbaCompositeKey;
26+
27+
}

src/Models/ArCdKh.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* @copyright © 2019 Dxvn, Inc.
7+
*
8+
* @author Tran Ngoc Duc <ductn@diepxuan.com>
9+
*
10+
* @lastupdate 2026-06-21
11+
*/
12+
13+
namespace Diepxuan\Simba\Models;
14+
15+
use Diepxuan\Simba\Models\Concerns\HasSimbaCompositeKey;
16+
use Diepxuan\Simba\SModel\ArCdKhModel;
17+
18+
/**
19+
* Model ArCdKh.
20+
*
21+
* Lớp Simba model trực tiếp cho bảng `ArCdKh`, kế thừa schema từ `ArCdKhModel`.
22+
*/
23+
class ArCdKh extends ArCdKhModel
24+
{
25+
use HasSimbaCompositeKey;
26+
27+
}

src/Models/ArCdKh13.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* @copyright © 2019 Dxvn, Inc.
7+
*
8+
* @author Tran Ngoc Duc <ductn@diepxuan.com>
9+
*
10+
* @lastupdate 2026-06-21
11+
*/
12+
13+
namespace Diepxuan\Simba\Models;
14+
15+
use Diepxuan\Simba\Models\Concerns\HasSimbaCompositeKey;
16+
use Diepxuan\Simba\SModel\ArCdKh13Model;
17+
18+
/**
19+
* Model ArCdKh13.
20+
*
21+
* Lớp Simba model trực tiếp cho bảng `ArCdKh13`, kế thừa schema từ `ArCdKh13Model`.
22+
*/
23+
class ArCdKh13 extends ArCdKh13Model
24+
{
25+
use HasSimbaCompositeKey;
26+
27+
}

0 commit comments

Comments
 (0)