miniCal
  • Quick Start
    • Introduction
  • miniCal Configuration
    • miniCal Hosted Service
    • Configure Feature Settings
    • Install Extensions
    • Create Multiple Properties
  • Local Installation
    • Local Installation
    • ENV Set-Up
    • Configuration Settings
    • Common Installations Errors
  • Contribution
    • Contribute to miniCal Core
  • Build an Extension
    • Build Your First Extension
      • Controllers
      • Assets
      • Config
      • language
      • Models
      • View
      • Helper
      • Library
      • Hooks
    • Open-source Extensions
    • Config Folder Files
      • Autoload File
      • Config File
      • Route File
    • miniCal Filters
    • miniCal Actions
    • Create Custom Hooks
    • Store Custom Data
      • POSTS
      • POSTMETA
      • OPTIONS
    • Composer Dependencies
  • Marketplace
    • miniCal Marketplace
  • Other resources
    • Overbooking for OTAs
    • miniCal Cron Setup
    • Automated Night Audit
    • Nginx Configuration
    • Docker Installation
    • Custom Domain Setup
  • Minical API Docs
    • API Documentation
  • Coming soon!
    • Access minical Data Using Helpers
      • Company Helper Functions
      • Customer Helper Functions
      • Booking Helper Functions
      • Rates Helper Functions
      • Rate Plan Helper Functions
      • Availability Helper Functions
      • Statement Helper Functions
      • Tax Helper Functions
      • Room Helper Functions
      • Charge Helper Functions
      • Payment Helper Functions
    • Access data in Extension
Powered by GitBook
On this page
  • Understanding and Working With the miniCal POST and POST-META Tables
  • Understanding and Working With the miniCal OPTIONS Table
  1. Build an Extension

Store Custom Data

Store custom data for an extension

PreviousCreate Custom HooksNextPOSTS

Last updated 3 years ago

Understanding and Working With the miniCal POST and POST-META Tables

Suppose you are building an extension that requires a database to save the extension specify info. For instance, you need to capture username and mail-id so these details will go on the "post" and "post-meta" tables.

Understanding and Working With the miniCal OPTIONS Table

The options table stores a different kind of data from the other tables: instead of storing data about your extension content, it stores data about the application itself. miniCal provides a set of functions to add, update and delete data from this table. You can add values to existing options and you can also add new records to the table when you want to create new options.

Method
Description
Parameters Description
Return value

add_option()

Adds a new option value.

add_option(string $option, $value = '', bool $autoload = true) 1. string $option (Required) Name of the option to add. 2. mixed $value (Optional) Option value. 3. bool $autoload (Optional) Whether to load the option when extension starts up. Default is enabled.

bool True if the option was added, null otherwise.

get_option()

Get option value.

get_option( string $option, bool $default = false) 1. string $option (Required) Name of the option to add. 2. bool $default (Optional) Default value to return if the option does not exist.

bool Value of the option. A value of any type may be returned, If there is no option in the database, boolean false is returned

update_option()

Update option value.

update_option( string $option, $value = '', bool $autoload = true ) 1. string $option (Required) Name of the option to update. 2. mixed $value (Required) Option value. 3. bool $autoload (Optional) Whether to load the option when extension starts up. Default is enabled.

bool True if the value was updated, false otherwise.

delete_option()

delete option value.

delete_option( string $option ) 1. string $option (Required) Name of the option to delete.

bool True if the option was deleted, false otherwise.

add_post_meta()

Adds a new postmeta value.

add_post_meta ($post_id, $key, $value) 1. int $post_id (Required) The id of the post corresponds to the postmeta data. 2. string $key (Required) The meta key. 3. mixed $value (Required) The meta value to the corresponding key.

null

get_postmeta()

Get postmeta value.

get_post_meta(int $post_id = null, string $key = null, bool $single = false ) 1. int $post_id The id of the post corresponds to the postmeta data. 2. string $key Optional, The meta key to retrieve. By default, returns data for all keys. 3. boolean $single Optional Whether to return a single value. This parameter has no effect if $key is not specified.

mixed Either array or null, if postmeta data is available or no error occurs, then array else null.

update_postmeta()

Update postmeta value.

update_post_meta(array $post_meta = null, int $post_id = null) 1. array $post_meta An array of postmeta data to be updated. 2. int $post_id The id of the post corresponds to the postmeta data.

mixed Either true or null, if postmeta data is updated then true else null.

detele_postmeta()

Detele postmeta value.

delete_post_meta(int $post_id = null, string $meta_key = null, $meta_value = null) 1. int $post_id The id of the post corresponds to the postmeta data. 2. string $meta_key name of key. 3. mixed $meta_value value of key this will make delete more certain (in case key name is same).

mixed Either true or null, if postmeta data is deleted then true else null.

add_post()

Adds a new post value.

add_post ($data) 1. array $data the data array of post.

null

get_post()

Get post value.

get_post( $post ) 1. mixed $post Int id of post or An Array of post data, this key will be added in where clause.

mixed Either array or null, if post data is available or no error occurs, then array else null.

edit_post()

Update post value.

edit_post(array $post = null) 1. array $post An Array of post data including post_id.

mixed Either post_id or null, if post data is updated or no error occurs, then id else null.

detele_post()

Detele post value.

delete_post(int $post_id = null, bool $force_delete = false ) 1. int $post_id The id of the post. 2. bool $force_delete flag to force delete a post, default is false..

mixed Either true or null, if postmeta data is delete then true else null.

POSTS
POSTMETA
OPTIONS