1. Go to this page and download the library: Download sukorenomw/rclient library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/*
* Same as fetching object, but in singular form (without 's')
* the second argument can be id or slug or etc ..
* this is dynamic function call to Roketin Engine API
*/
$home = Roketin::menu('home')->get();
$post = Roketin::post('latest-update')->get();
/**
* @param $field
* @param $operation
* @param $value
*/
$posts = Roketin::posts()->where('title','like','vacation')->get();
//NOTE :
//It doesn't need to add % if using 'like' operator
/**
* @param $field
* @param $operation
* @param $value
*/
$posts = Roketin::posts()
->where('title','like','vacation')
->orWhere('title','like','holiday')
->get();
//NOTE :
//It doesn't need to add % if using 'like' operator
/**
* @param $field
* @param $operation
* @param $value
*/
$posts = Roketin::posts()
->where('title','like','vacation')
->orWhere('title','like','holiday')
->where('date','>=','2016-04-10')
->where('date','<=','2016-04-18')
->get();
//NOTE :
//It will result query grouping
// (title like vacation or title like holiday)
// AND
// (date >= 2016-04-10 and date <= 2016-04-18 )
/*
* @param $destination = city id
* @param $courier = JNE/TIKI/POS
* @param $weight = item weight in KG (optional) default value 1
* @param $origin = city id
*/
$costs = Roketin::shipping()->cost(23, 'JNE')
/*
* @param $code
* @param $voucher_type (optional), default = null
* voucher type can be giftvoucher (voucher in
* exchange to money nominal) or
* other (voucher to exchange to free product)
* default is voucher_type is other
*/
$check = Roketin::voucher()->check('AS123D')
/*
* @param $voucher_code
* @param $voucher_type (optional) default is other
* @param $used_by (optional) default is logged in user
*/
$check = Roketin::voucher()->invalidate('AS123D')