krgm.so-manager-dev.com/app/Models/City.php
go.unhi 5b0d8b1ee5
All checks were successful
Deploy main / deploy (push) Successful in 24s
更新 app/Models/City.php
2025-09-01 10:15:33 +09:00

37 lines
782 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class City extends Model
{
protected $table = 'city';
protected $primaryKey = 'city_id';
protected $keyType = 'int';
public $incrementing = true;
protected $fillable = [
'city_id',
'city_name',
'print_layout',
'city_user',
'city_remarks',
'created_at',
'updated_at',
];
/**
* 都市のリストを取得
*/
public static function getList(?int $operatorId = null): array
{
return static::query()
->when($operatorId, fn ($q) => $q->where('operator_id', $operatorId))
->orderBy('city_name')
->pluck('city_name', 'city_id')
->toArray();
}
}