Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @link https://www.github.com/hscstudio/yii2-cart
* @copyright Copyright (c) 2016 HafidMukhlasin.com
* @license http://www.yiiframework.com/license/
*/
namespace hscstudio\cart;
use Yii;
Item Storage 2
array(2) { [0]=> object(app\models\Product)#121 (9) { ["_attributes":"yii\db\BaseActiveRecord":private]=> array(13) { ["id"]=> int(1) ["title"]=> string(5) "Apple" ["description"]=> string(9) "Apple is " ["picture"]=> NULL ["thumbnail"]=> NULL ["price"]=> string(8) "15000.00" ["weight"]=> int(1000) ["stock"]=> int(3) ["status"]=> int(1) ["created_at"]=> NULL ["updated_at"]=> NULL ["created_by"]=> NULL ["updated_by"]=> NULL } ["_oldAttributes":"yii\db\BaseActiveRecord":private]=> array(13) { ["id"]=> int(1) ["title"]=> string(5) "Apple" ["description"]=> string(9) "Apple is " ["picture"]=> NULL ["thumbnail"]=> NULL ["price"]=> string(8) "15000.00" ["weight"]=> int(1000) ["stock"]=> int(3) ["status"]=> int(1) ["created_at"]=> NULL ["updated_at"]=> NULL ["created_by"]=> NULL ["updated_by"]=> NULL } ["_related":"yii\db\BaseActiveRecord":private]=> array(0) { } ["_errors":"yii\base\Model":private]=> NULL ["_validators":"yii\base\Model":private]=> NULL ["_scenario":"yii\base\Model":private]=> string(
public function sync(Cart $cart) {
$this->storages[0]->read($cart);
$last_cart = clone $cart;
$this->storages[0]->lock(true, $cart);
$cart = $last_cart;
$this->storages[1]->read($cart);
$this->storages[1]->write($cart);
/*$this->storages[1]->read($cart);
$current_cart = clone $cart;
public function actionGetCekResi($resi='2784499770009')
{
$client = new Client();
$response = $client->createRequest()
->setMethod('post')
->setUrl('http://api.cekresi.co.id/cnote.php')
->setData(['id' => $resi])
->send();
if ($response->isOk) {
echo ($response->content);
<script type="text/javascript">jQuery(document).ready(function () {
if(window.EventSource !== undefined){
var es = new EventSource("/message/get-message");
es.addEventListener("message", function(e) {
var data = JSON.parse(e.data);
// GET BADGE MESSAGE
var selector = "li.messages-menu > a > span";
if ($(selector).length && data.count>0) {
$(selector).html(data.count)
// view index.php
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
use yii\helpers\Url;
?>
<div class="category-index">
'on beforeAction' => function($event){
$action = $event->action;
$moduleID = $action->controller->module->id;
$controllerID = $action->controller->id;
$actionID = $action->id;
$user = \Yii::$app->user;
$userID = $user->id;
if(!in_array($controllerID,['default','site'])){
$auth = \app\models\Auth::find()
->where([
public function actionIndex($year='')
{
if(empty($year)) $year=date('Y');
$searchModel = new TrainingSearch();
$queryParams = Yii::$app->request->getQueryParams();
if($year!='all'){
$queryParams['TrainingSearch']=[
'year' => $year,
];
}
<?php
/**
* Description of DView
*
* @author Misbahul D Munir <[email protected]>
* @since 1.0
*/
class DView
{

Bapak Ketua Majelis Hakim, dan Anggota Majelis Hakim yang saya muliakan,

Sdr. Jaksa Penuntut Umum yang saya hormati,

Penasihat Hukum dan Para Hadirin yang saya hormati,

Pertama-tama saya ingin menyampaikan terima kasih kepada Majelis Hakim atas kesempatan, yang diberikan kepada Saya.

Berkaitan dengan persoalan yang terjadi saat ini, dimana saya diajukan di hadapan sidang, jelas apa yang saya utarakan di Kepulauan Seribu, bukan dimaksudkan untuk menafsirkan Surat Al-Maidah 51 apalagi berniat menista agama Islam, dan juga berniat untuk menghina para Ulama. Namun ucapan itu, saya maksudkan, untuk para oknum politisi, yang memanfaatkan Surat Al-Maidah 51, secara tidak benar karena tidak mau bersaing secara sehat dalam persaingan Pilkada.