| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 | 
							- <?php
 - 
 - namespace App\Http\Services\Backend\DataManagement;
 - 
 - use App\Http\Services\ConstDef\GeneralConst;
 - use App\Models\SignupData;
 - use DB;
 - use Log;
 - use PhpOffice\PhpSpreadsheet\IOFactory;
 - use PhpOffice\PhpSpreadsheet\Spreadsheet;
 - 
 - class SignupManagementService
 - {
 -     
 -     // 相關私有 model 調用器宣告
 -     private $signupDb;
 -     public function __construct()
 -     {
 -         // 建構 model 調用器
 -         $this->signupDb=new SignupData();
 -     }
 -     public function getList(&$cnt = 0, $orderColumn, $orderDir, $start, $length, $searchValue, $keyword)
 -     {
 -         // 調用資料庫(或者其他業務邏輯)
 -         $res = $this->signupDb
 -             ->select('*');
 -             
 -         if ($keyword != ""){
 - 
 -             $res->where('firstName', $keyword)
 -                 ->orWhere('lastName', $keyword)
 -                 ->orWhere('companyName', $keyword)
 -                 ->orWhere('companyEmail', $keyword)
 -                 ->orWhere('backupEmail', $keyword)
 -                 ->orWhere('phoneNumber', $keyword)
 -                 ->orWhere('country', $keyword)
 -                 ->orWhere('trackNo', $keyword)
 -                 ->orWhere('typeOfIndustry', $keyword)
 -                 ->orWhere('typeOfJob', $keyword)
 -                 ->orWhere('jobTitle', $keyword);
 -         }
 -             
 -         // 取總筆數
 -         $cnt = $res->count();
 -         // 排序
 -         $res = $res
 -             ->orderByRaw((int)$orderColumn . ' ' . $orderDir);
 -         // 分頁
 -         $res = $res
 -             ->skip($start)->take($length);
 -         // 實際取資料
 -         $result = $res
 -             ->get()
 -             ->toArray();
 -         
 -         // 整理返回值並返回
 -         return $result;
 -     }
 - 
 -     public function getExportList($keyword)
 -     {
 -         $res = $this->signupDb
 -             ->select('*');
 -             
 -         if ($keyword != ""){
 - 
 -             $res->where('firstName', $keyword)
 -                 ->orWhere('lastName', $keyword)
 -                 ->orWhere('companyName', $keyword)
 -                 ->orWhere('companyEmail', $keyword)
 -                 ->orWhere('backupEmail', $keyword)
 -                 ->orWhere('phoneNumber', $keyword)
 -                 ->orWhere('country', $keyword)
 -                 ->orWhere('trackNo', $keyword)
 -                 ->orWhere('typeOfIndustry', $keyword)
 -                 ->orWhere('typeOfJob', $keyword)
 -                 ->orWhere('jobTitle', $keyword);
 -         }
 -         $res = $this->signupDb
 -             ->get()
 -             ->toArray();
 -         
 -         // 整理返回值並返回
 -         return $res;
 -     }
 - 
 - }
 
 
  |