orderBy($inputs['sort'], $inputs['sort_type']); } if ($inputs['isExport']){ $list = $list->get(); }else{ $list = $list->paginate(Utils::item_per_page); } return $list; } public static function getByPk($pk) { return self::find($pk); } public static function deleteByPk($arr) { return self::whereIn('park_id', $arr)->delete(); } public static function boot() { parent::boot(); self::creating(function (Park $model) { $model->operator_id = Auth::user()->ope_id ?? null; }); } /** * GET 閉設フラグ */ public function getParkCloseFlagDisplay() { if($this->park_close_flag == 1) { return '閉設'; } else if($this->park_close_flag == 0) { return '開設'; } return ''; } public function getCity() { // city_id => city_id (City モデル要有 city_id PK) return $this->belongsTo(City::class, 'city_id', 'city_id')->first(); } public static function getList(){ return self::pluck('park_name','park_id'); } public static function getIdByName($park_name){ return self::where('park_name',$park_name)->pluck('park_id')->first(); } }