Skip to content

Instantly share code, notes, and snippets.

View ydatech's full-sized avatar
🏠
Working from home

Yuda Sukmana ydatech

🏠
Working from home
View GitHub Profile
@ydatech
ydatech / extraFields.php
Last active September 25, 2017 05:51
to om surya
<?php
public function extraFields()
{
$extraFields = [];
$extraFields['desaPerServers'] = function ($model) {
$desaPerServers = $model->desaPerServers;
$arrdesaPerServers = [];
foreach ($desaPerServers as $i => $desa) {
@ydatech
ydatech / MoveLayer.js
Last active February 1, 2017 23:19
Class that I proud of
/*
* MoveLayer (ES6 class)
* Move array item up and down
*/
class MoveLayer{
static to(direction ='up',data = { items:[] , activeIndex:0}){
if(data.activeIndex >= data.items.length-1 || data.activeIndex <= 0 || !Array.isArray(data.items))
{
@ydatech
ydatech / add-status.sh
Created October 16, 2016 09:18
Menambahkan kolom status ke tabel iklan
#generate file migrasi untuk menambahkan kolom status pada tabel iklan
php yii migrate/create add_status_column_to_iklan_table --fields="status:smallinteger"
#terapkan migrasi ke database
php yii migrate
@ydatech
ydatech / Kontak.php
Last active October 9, 2016 12:35
Kontak.php
<?php
namespace app\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\behaviors\AttributeBehavior;
use yii\db\ActiveRecord;
/**
@ydatech
ydatech / web.php
Created October 9, 2016 11:57
urlManager
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
'GET '=>'site/index',
'POST auth/signup'=>'auth/signup',
'POST auth/login'=>'auth/login',
'GET lokasi'=>'lokasi/index',
'GET kategori'=>'kategori/index',
@ydatech
ydatech / KontakController.php
Created October 9, 2016 11:49
KontakController
<?php
namespace app\controllers;
use Yii;
use yii\data\ActiveDataProvider;
use yii\web\ForbiddenHttpException;
class KontakController extends ActiveController{
@ydatech
ydatech / ActiveController.php
Created October 9, 2016 11:29
ActiveController
<?php
namespace app\controllers;
use yii\filters\Cors;
use yii\filters\auth\HttpBearerAuth;
class ActiveController extends \yii\rest\ActiveController{
@ydatech
ydatech / Kategori.php
Created October 2, 2016 13:18
Kategori Endpoint
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "kategori".
*
* @property integer $id
@ydatech
ydatech / web.php
Created October 2, 2016 12:54
edit Config
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
'GET '=>'site/index',
'POST auth/signup'=>'auth/signup',
'POST auth/login'=>'auth/login',
'GET lokasi'=>'lokasi/index'
@ydatech
ydatech / Provinsi.php
Created October 2, 2016 12:50
Model Provinsi
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "provinsi".
*
* @property integer $id