krgm.so-manager-dev.com/app/Models/management.php
OU.ZAIKOU 13d2ecfceb
All checks were successful
Deploy main / deploy (push) Successful in 25s
【ログイン】二重認証実装
2026-01-21 22:37:38 +09:00

63 lines
1.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Management extends Model
{
/** テーブル名 */
protected $table = 'management';
/** 主キー */
protected $primaryKey = 'management_id';
/** 自動インクリメント */
public $incrementing = true;
/** 主キー型 */
protected $keyType = 'int';
/** タイムスタンプcreated_at / updated_at */
public $timestamps = true;
/** 一括代入を許可する項目 */
protected $fillable = [
'management_name', // 運営元名
'management_code', // 運営元コードURL用
'municipality_flag', // 自治体フラグ
'tel', // 電話番号
'service_time', // 受付時間
'government_approval_required', // 役所承認要否
];
/** 型キャスト */
protected $casts = [
'management_id' => 'integer',
'municipality_flag' => 'integer',
'government_approval_required' => 'integer',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/** 自治体かどうかを判定 */
public function isMunicipality(): bool
{
return (int)$this->municipality_flag === 1;
}
/** 役所承認が必要かどうか */
public function requiresGovernmentApproval(): bool
{
return (int)$this->government_approval_required === 1;
}
/**
* この運営元に属する自治体を取得
*/
public function cities(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(City::class, 'management_id', 'management_id');
}
}