You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
899B

  1. <?php
  2. namespace App\Models\Htpms;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Database\Query\Builder;
  5. use Illuminate\Support\Facades\DB;
  6. class MstCustomer extends Model
  7. {
  8. const COL_NAME_ID = 'id';
  9. const COL_NAME_CUSTOMER_ID = 'customer_id';
  10. const COL_NAME_CUSTOMER_NAME = 'customer_name';
  11. protected $connection = 'htpms';
  12. protected $table = 'mst_customer';
  13. protected $fillable = []; // 参照専用
  14. protected $visible = [
  15. self::COL_NAME_ID,
  16. self::COL_NAME_CUSTOMER_ID,
  17. self::COL_NAME_CUSTOMER_NAME,
  18. ];
  19. public static function getBuilder(string $name = 'main'): Builder
  20. {
  21. $instance = new static();
  22. return DB::connection($instance->getConnectionName())->table(static::getTableName(), $name);
  23. }
  24. public static function getTableName(): string
  25. {
  26. return (new static)->getTable();
  27. }
  28. }