# Company Helper Functions

### function get\_company($company\_id) {....}

**Supported hooks**&#x20;

**Filter name:**  before\_get\_company\
**Description:** This filter would be executed before retrieving company details from database in get\_company helper.\
**Usage:**

```php
// The filter callback function is based on the filter.
add_filter('before_get_company', 'before_get_company_callback_fn', 10, 1);
 
function before_get_company_callback_fn ($company_id) {
   // This filter would be executed before retrieving company details from database in get_company helper.
}
```

**Filter name:**  should\_get\_company\
**Description:** This filter would be executed before retrieving company details from database in get\_company helper.\
**Usage:**

```php
// The filter callback function is based on the filter.
add_filter('should_get_company', 'should_get_company_callback_fn', 10, 1);

function should_get_company_callback_fn ($company_id) {
   // This filter would be executed before retrieving company details from database in get_company helper.
}
```

**Hook name :**  pre.get.company\
**Description:** This hook would be executed before retrieving company details from database in get\_company helper.\
**Usage:**

```php
// The filter callback function is based on the filter.
add_filter('pre.get.company', 'pre_get_company_callback_fn', 10, 1);

function pre_get_company_callback_fn ($company_id) {
   // This filter would be executed before retrieving comapny from database in get_company helper.
}
```

**Hook name :**  post.get.company\
**Description:** This hook would be executed after retrieving company details from database in get\_company helper.\
**Usage:**

```php
// The filter callback function is based on the filter.
add_filter('post.get.company', ' post_get_company_callback_fn', 10, 1);

function post_get_company_callback_fn ($company_id) {
    // This filter would be executed before retrieving company details from database in get_company helper.
}
```

**Usage**

```php
// for use company helper you need to add this helper on controller or
// you can autoload this helper.
$this->load->helper('includes/company');

// Retrieves company data or settings based on a company_id.
$company_data = get_company($company_id);
```

**Request Parameters**

<table><thead><tr><th>Param</th><th>Type</th><th width="150">Required</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td>$company_id</td><td>Integer</td><td>Yes</td><td>Null</td><td>Company Id is the primary key for the company table.</td></tr></tbody></table>

**Response**

```php
// Successfully response giving you array of company & settings details.

Array
(
    [company_id] => 1
    [name] => honey & bunny
    [address] => 
    [phone] => 
    [city] => 
    [region] => 
    [country] => India
    [website] => 
    [email] => test@minical.io
    [fax] => 
    [selling_date] => 2022-01-27
    [nightly_audit_charge_id] => 
    [time_zone] => Pacific/Midway
    [GST_number] => 
    [postal_code] => 
    [is_daily_rate_including_tax] => 0
    [is_setup] => 0
    [number_of_rooms] => 10
    [reservation_policies] => 
    [check_in_policies] => 
    [night_audit_auto_prompt] => 0
    [night_audit_auto_prompt_time] => 00:00:00
    [night_audit_force_check_out] => 0
    [night_audit_multiple_days] => 0
    [require_paypal_payment] => 0
    [paypal_account] => 
    [percentage_of_required_paypal_payment] => 50
    [housekeeping_auto_clean_is_enabled] => 1
    [housekeeping_auto_clean_time] => 16:00:00
    [housekeeping_day_interval_for_full_cleaning] => 4
    [online_reservation_confirmation_message] => To secure your reservation spot, please confirm your reservation with the [name] by calling [phone] or by sending email to [email]
    [default_currency_id] => 151
    [night_audit_auto_run_is_enabled] => 0
    [night_audit_auto_run_time] => 04:00:00
    [property_type] => 0
    [invoice_email_header] => 
    [booking_confirmation_email_header] => 
    [send_invoice_email_automatically] => 1
    [ask_for_review_in_invoice_email] => 0
    [hide_decimal_places] => 0
    [companycol] => 
    [redirect_to_trip_advisor] => 0
    [tripadvisor_link] => 
    [employee_auto_logout_is_enabled] => 0
    [api_key] => 
    [website_uri] => 
    [website_about] => 
    [website_latitude] => 
    [website_longitude] => 
    [website_is_taking_online_reservation] => 0
    [website_theme_color] => EDE8EB
    [website_facebook_page_url] => 
    [website_tripadvisor_location_id] => 
    [google_analytics_id] => 
    [google_conversion_id] => 
    [google_conversion_label] => 
    [logo_image_id] => 
    [logo_image_group_id] => 1
    [gallery_image_group_id] => 3
    [slideshow_image_group_id] => 2
    [website_title] => 
    [website_tripadvisor_widget_type] => 0
    [allow_same_day_check_in] => 1
    [booking_email_confirmation_message] => This reservation is provisionary. It is not confirmed until the payment information is given from the customer. For questions, please contact us at [email].
    [invoice_header] => 
    [last_night_audit] => 
    [night_audit_charge_in_house_only] => 0
    [night_audit_ignore_check_out_date] => 0
    [book_over_unconfirmed_reservations] => 0
    [statement_number] => 1
    [enable_card_tokenization] => 1
    [booking_engine_booking_status] => 0
    [is_total_balance_include_forecast] => 1
    [is_display_tooltip] => 1
    [partner_id] => 0
    [booking_dot_com_rate_type] => base_rate
    [common_additional_adult_rate] => 
    [allow_non_continuous_bookings] => 1
    [maximum_no_of_blocks] => 2
    [manual_payment_capture] => 0
    [include_cancelled_noshow_bookings] => 1
    [force_room_selection] => 1
    [send_copy_to_additional_emails] => 0
    [additional_company_emails] => 
    [hide_forecast_charges] => 0
    [housekeeping_auto_dirty_is_enabled] => 0
    [housekeeping_auto_dirty_time] => 16:00:00
    [automatic_feedback_email] => 0
    [subscription_country] => US
    [auto_no_show] => 1
    [last_login] => 
    [show_rate_on_registration_card] => 1
    [automatic_email_confirmation] => 0
    [automatic_email_cancellation] => 0
    [email_confirmation_for_ota_reservations] => 0
    [make_guest_field_mandatory] => 0
    [is_deleted] => 0
    [ui_theme] => 1
    [default_charge_name] => Room Charge
    [date_format] => YY-MM-DD
    [default_room_singular] => room
    [default_room_plural] => rooms
    [default_room_type] => room type
    [avoid_dmarc_blocking] => 0
    [enable_hourly_booking] => 0
    [default_checkin_time] => 12:00 AM
    [default_checkout_time] => 12:00 AM
    [allow_free_bookings] => 0
    [show_logo_on_registration_card] => 0
    [restrict_booking_dates_modification] => 0
    [restrict_checkout_with_balance] => 0
    [enable_api_access] => 1
    [customer_modify_booking] => 0
    [booking_cancelled_with_balance] => 0
    [booking_checkedout_with_balance] => 0
    [enable_new_calendar] => 1
    [default_language] => 1
    [hide_room_name] => 0
    [email_confirmation_for_booking_engine] => 0
    [is_cc_visualization_enabled] => 0
    [send_booking_notes] => 0
    [show_guest_group_invoice] => 0
    [booking_engine_tracking_code] => 
    [email_cancellation_for_ota_reservations] => 0
    [salesforce_url] => 
    [admin_comment] => 
    [creation_date] => 2021-12-10
    [trial_expiry_date] => 2021-12-24
    [trial_extension_reason] => 
    [conversion_date] => 
    [churn_date] => 
    [lead_source_id] => 0
    [utm_source] => 
    [inhouse_settings] => 
    [reservation_settings] => 
    [permission_id] => 2
    [user_id] => 1
    [permission] => is_owner
    [subscription_level] => 0
    [limit_feature] => 1
    [subscription_state] => trialing
    [payment_method] => none
    [subscription_id] => 
    [balance] => 0.00
    [owner_email] => test@minical.io
    [id] => 1
    [current_company_id] => 1
    [first_name] => support
    [last_name] => minical
    [language] => english
    [language_id] => 1
    [number_of_rooms_actual] => 10
    [partner_name] => minical
    [selected_payment_gateway] => 
)

// If there is no company data for any company id provided in input or any error will return null.
```

### function get\_company\_data($company\_id) {....}

**Supported hooks**&#x20;

**Filter name:**  before\_get\_companies\
**Description:** This filter would be executed before retrieving company details from database in get\_company\_data helper.\
**Usage:**

```php
// The filter callback function is based on the filter.
add_filter('before_get_companies', 'before_get_companies_callback_fn', 10, 1);
 
function before_get_companies_callback_fn ($company_id) {
   // This filter would be executed before retrieving company details from database in get_company helper.
}
```

**Filter name:**  should\_get\_companies\
**Description:** This filter would be executed before retrieving company details from database in get\_company\_data helper.\
**Usage:**

```php
// The filter callback function is based on the filter.
add_filter('should_get_companies', 'should_get_companies_callback_fn', 10, 1);

function should_get_companies_callback_fn ($company_id) {
   // This filter would be executed before retrieving company details from database in get_company helper.
}
```

**Hook name :**  pre.get.companies\
**Description:** This hook would be executed before retrieving company details from database in get\_company\_data helper.\
**Usage:**

```php
// The filter callback function is based on the filter.
add_filter('pre.get.companies', 'pre_get_companies_callback_fn', 10, 1);

function pre_get_companies_callback_fn ($company_id) {
   // This filter would be executed before retrieving company from database in get_company_data helper.
}
```

**Hook name :**  post.get.companies\
**Description:** This hook would be executed after retrieving company details from database in get\_company\_data helper.\
**Usage:**

```php
// The filter callback function is based on the filter.
add_filter('post.get.companies', ' post_get_companies_callback_fn', 10, 1);

function post_get_companies_callback_fn ($company_id) {
    // This filter would be executed before retrieving company details from database in get_company_data helper.
}
```

**Usage**

```php
// for use company helper you need to add this helper on controller or
// you can autoload this helper.
$this->load->helper('includes/company');

// Retrieves company data or settings based on a company_id. 
// this function will proivde join data from room, user, user_profiles tables
$company_data = get_company_data($company_id);
```

**Request Parameters**

<table><thead><tr><th>Param</th><th>Type</th><th width="150">Required</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td>$company_id</td><td>Integer</td><td>Yes</td><td>Null</td><td>Company Id is the primary key for the company table.</td></tr></tbody></table>

**Response**

```php
// Successfully response giving you array of company data.

Array
(
    [company_id] => 1
    [name] => honey & bunny
    [address] => 
    [phone] => 
    [city] => 
    [region] => 
    [country] => India
    [website] => 
    [email] => support@minical.io
    [fax] => 
    [selling_date] => 2022-01-27
    [nightly_audit_charge_id] => 
    [time_zone] => Pacific/Midway
    [GST_number] => 
    [postal_code] => 
    [is_daily_rate_including_tax] => 0
    [is_setup] => 0
    [number_of_rooms] => 10
    [reservation_policies] => 
    [check_in_policies] => 
    [night_audit_auto_prompt] => 0
    [night_audit_auto_prompt_time] => 00:00:00
    [night_audit_force_check_out] => 0
    [night_audit_multiple_days] => 0
    [require_paypal_payment] => 0
    [paypal_account] => 
    [percentage_of_required_paypal_payment] => 50
    [housekeeping_auto_clean_is_enabled] => 1
    [housekeeping_auto_clean_time] => 16:00:00
    [housekeeping_day_interval_for_full_cleaning] => 4
    [online_reservation_confirmation_message] => To secure your reservation spot, please confirm your reservation with the [name] by calling [phone] or by sending email to [email]
    [default_currency_id] => 151
    [night_audit_auto_run_is_enabled] => 0
    [night_audit_auto_run_time] => 04:00:00
    [property_type] => 0
    [invoice_email_header] => 
    [booking_confirmation_email_header] => 
    [send_invoice_email_automatically] => 1
    [ask_for_review_in_invoice_email] => 0
    [hide_decimal_places] => 0
    [companycol] => 
    [redirect_to_trip_advisor] => 0
    [tripadvisor_link] => 
    [employee_auto_logout_is_enabled] => 0
    [api_key] => 
    [website_uri] => 
    [website_about] => 
    [website_latitude] => 
    [website_longitude] => 
    [website_is_taking_online_reservation] => 0
    [website_theme_color] => EDE8EB
    [website_facebook_page_url] => 
    [website_tripadvisor_location_id] => 
    [google_analytics_id] => 
    [google_conversion_id] => 
    [google_conversion_label] => 
    [logo_image_id] => 
    [logo_image_group_id] => 1
    [gallery_image_group_id] => 3
    [slideshow_image_group_id] => 2
    [website_title] => 
    [website_tripadvisor_widget_type] => 0
    [allow_same_day_check_in] => 1
    [booking_email_confirmation_message] => This reservation is provisionary. It is not confirmed until the payment information is given from the customer. For questions, please contact us at [email].
    [invoice_header] => 
    [last_night_audit] => 
    [night_audit_charge_in_house_only] => 0
    [night_audit_ignore_check_out_date] => 0
    [book_over_unconfirmed_reservations] => 0
    [statement_number] => 1
    [enable_card_tokenization] => 1
    [booking_engine_booking_status] => 0
    [is_total_balance_include_forecast] => 1
    [is_display_tooltip] => 1
    [partner_id] => 0
    [booking_dot_com_rate_type] => base_rate
    [common_additional_adult_rate] => 
    [allow_non_continuous_bookings] => 1
    [maximum_no_of_blocks] => 2
    [manual_payment_capture] => 0
    [include_cancelled_noshow_bookings] => 1
    [force_room_selection] => 1
    [send_copy_to_additional_emails] => 0
    [additional_company_emails] => 
    [hide_forecast_charges] => 0
    [housekeeping_auto_dirty_is_enabled] => 0
    [housekeeping_auto_dirty_time] => 16:00:00
    [automatic_feedback_email] => 0
    [subscription_country] => US
    [auto_no_show] => 1
    [last_login] => 
    [show_rate_on_registration_card] => 1
    [automatic_email_confirmation] => 0
    [automatic_email_cancellation] => 0
    [email_confirmation_for_ota_reservations] => 0
    [make_guest_field_mandatory] => 0
    [is_deleted] => 0
    [ui_theme] => 1
    [default_charge_name] => Room Charge
    [date_format] => YY-MM-DD
    [default_room_singular] => room
    [default_room_plural] => rooms
    [default_room_type] => room type
    [avoid_dmarc_blocking] => 0
    [enable_hourly_booking] => 0
    [default_checkin_time] => 12:00 AM
    [default_checkout_time] => 12:00 AM
    [allow_free_bookings] => 0
    [show_logo_on_registration_card] => 0
    [restrict_booking_dates_modification] => 0
    [restrict_checkout_with_balance] => 0
    [enable_api_access] => 1
    [customer_modify_booking] => 0
    [booking_cancelled_with_balance] => 0
    [booking_checkedout_with_balance] => 0
    [enable_new_calendar] => 1
    [default_language] => 1
    [hide_room_name] => 0
    [email_confirmation_for_booking_engine] => 0
    [is_cc_visualization_enabled] => 0
    [send_booking_notes] => 0
    [show_guest_group_invoice] => 0
    [booking_engine_tracking_code] => 
    [email_cancellation_for_ota_reservations] => 0
)
// If there is no company data for any company id provided in input or any error will return null.
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.minical.io/coming-soon/access-minical-data-using-helpers/company-helper-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
