59 lines
1.2 KiB
PHP
59 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Legacy;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
/**
|
|
* 旧システム 駐輪場モデル(互換)
|
|
* - テーブル: park
|
|
* - 主キー: park_id
|
|
*/
|
|
class Park extends Model
|
|
{
|
|
public const CREATED_AT = 'created_at';
|
|
public const UPDATED_AT = 'updated_at';
|
|
|
|
protected $table = 'park';
|
|
protected $primaryKey = 'park_id';
|
|
|
|
protected $fillable = [
|
|
'park_name',
|
|
'park_ruby',
|
|
'park_syllabary',
|
|
'park_adrs',
|
|
'park_close_flag',
|
|
'park_day',
|
|
'alert_flag',
|
|
'print_number',
|
|
'keep_alive',
|
|
];
|
|
|
|
protected static function boot()
|
|
{
|
|
parent::boot();
|
|
static::creating(function (Park $model) {
|
|
if (Auth::check() && property_exists($model, 'operator_id')) {
|
|
$model->operator_id = Auth::user()->ope_id ?? null;
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 閉設フラグの表示(旧互換)
|
|
*/
|
|
public function getParkCloseFlagDisplay()
|
|
{
|
|
if ($this->park_close_flag === 1) {
|
|
return '閉設';
|
|
}
|
|
if ($this->park_close_flag === 0) {
|
|
return '開設';
|
|
}
|
|
return '';
|
|
}
|
|
}
|
|
|
|
|