You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: appointment_checkins_controller.rb
    path of file: ./repos/circulate/app/controllers/admin
    
    the code of the file until where you have to start completion: module Admin
  class AppointmentCheckinsController < BaseController
    before_action :are_appointments_enabled?

    include Lending

    def create
      @appointment = Appointment.find(params[:appointment_id])
      @loans = @appointment.loans.checked_out.where(id: p
    
    def create
      @appointment = Appointment.find(params[:appointment_id])
      @loans = @appointment.loans.checked_out.where(id: params[:loan_ids])

      returned_loans = @appointment.member.transaction do
        @loans.each do |loan|
          return_loan(loan)
        end
      end
      returned_item_count = returned_loans&.count&.to_i

      redirect_to admin_appointment_path(@appointment), flash: {
        success: "#{helpers.pluralize(returned_item_count, "Item")} checked-in."
      }, status: :see_other
    end