\App\Enums\RoomStatus::class, ]; public function user(){ return $this->belongsTo(User::class); } public function room() { return $this->belongsTo(Room::class); } public function save(array $options = []) { throw new \Exception("RoomStatusLog is read-only."); } public function delete() { throw new \Exception("RoomStatusLog cannot be deleted."); } public static function create(array $attributes = []) { throw new \Exception("RoomStatusLog is read-only."); } public static function booted() { // 防止 mass update/delete static::updating(function () { throw new \Exception("Updating is not allowed."); }); static::deleting(function () { throw new \Exception("Deleting is not allowed."); }); } }