|
- <?php
-
- namespace App\Models\Htpms;
-
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Query\Builder;
- use Illuminate\Support\Facades\DB;
-
- class MstCustomer extends Model
- {
- const COL_NAME_ID = 'id';
- const COL_NAME_CUSTOMER_ID = 'customer_id';
- const COL_NAME_CUSTOMER_NAME = 'customer_name';
-
- protected $connection = 'htpms';
- protected $table = 'mst_customer';
- protected $fillable = []; // 参照専用
-
- protected $visible = [
- self::COL_NAME_ID,
- self::COL_NAME_CUSTOMER_ID,
- self::COL_NAME_CUSTOMER_NAME,
- ];
-
- public static function getBuilder(string $name = 'main'): Builder
- {
- $instance = new static();
- return DB::connection($instance->getConnectionName())->table(static::getTableName(), $name);
- }
-
- public static function getTableName(): string
- {
- return (new static)->getTable();
- }
- }
|