|
- <?php
-
- namespace App\Models\HtpmsCustomer\Existing;
-
- use App\Models\ColumnName;
- use App\Util\DateUtil;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Query\Builder;
- use Illuminate\Support\Facades\DB;
-
- class DiscountTicket extends Model
- {
- const COL_NAME_PARK_ID = 'park_id';
- const COL_NAME_TICKET_NAME = 'ticketname';
- const COL_NAME_DISCOUNT_TICKET_CODE = 'lineno';
-
- protected $connection = 'htpms_customer';
- protected $table = 'tbl2_discountticket';
- protected $fillable = []; // 参照専用
-
- protected $visible = [
- self::COL_NAME_TICKET_NAME,
- self::COL_NAME_DISCOUNT_TICKET_CODE,
- "ticket_name",
- ColumnName::DISCOUNT_TICKET_CODE,
- ];
-
-
- public static function getBuilder(string $name = 'main'): Builder
- {
- $now = DateUtil::now();
- $instance = new static();
- return DB::connection($instance->getConnectionName())->table(static::getTableName(), $name);
- }
-
- public static function getTableName(): string
- {
- return (new static)->getTable();
- }
- }
|