PHP code example of thotam / thotam-plus

1. Go to this page and download the library: Download thotam/thotam-plus library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thotam / thotam-plus example snippets


Add "Thotam\ThotamPlus\Traits\ThoTamPlusTrait" to Models you want to use

For ChiNhanh add:
$table->bigInteger('chinhanh_id')->unsigned()->nullable()->default(null);
$table->foreign('chinhanh_id')->references('id')->on('chinhanhs')->onDelete('SET NULL')->onUpdate('cascade');
to table

For KenhKinhDoanh add:
$table->bigInteger('kenh_kinh_doanh_id')->unsigned()->nullable()->default(null);
$table->foreign('kenh_kinh_doanh_id')->references('id')->on('kenh_kinh_doanhs')->onDelete('SET NULL')->onUpdate('cascade');
to table

For NhomSanPham add:
$table->bigInteger('nhom_san_pham_id')->unsigned()->nullable()->default(null);
$table->foreign('nhom_san_pham_id')->references('id')->on('nhom_san_phams')->onDelete('SET NULL')->onUpdate('cascade');
to table

Add "Thotam\ThotamPlus\Traits\TinhHuyenXaTrait" to Models you want to TinhHuyenXa

For Tinh add:
$table->bigInteger('tinh_id')->unsigned()->nullable()->default(null);
$table->foreign('tinh_id')->references('id')->on('list_tinhs')->onDelete('SET NULL')->onUpdate('cascade');
to table

For Huyen add:
$table->bigInteger('huyen_id')->unsigned()->nullable()->default(null);
$table->foreign('huyen_id')->references('id')->on('list_huyens')->onDelete('SET NULL')->onUpdate('cascade');
to table

For Xa add:
$table->bigInteger('xa_id')->unsigned()->nullable()->default(null);
$table->foreign('xa_id')->references('id')->on('list_xas')->onDelete('SET NULL')->onUpdate('cascade');
to table

Add "Thotam\ThotamPlus\Traits\ChiNhanhTrait" to "Thotam\ThotamHr\Models\HR" Model

php artisan migrate

php artisan db:seed