Skip to content

Instantly share code, notes, and snippets.

View uyab's full-sized avatar
👽
Write code for humans

Bayu Hendra Winata uyab

👽
Write code for humans
View GitHub Profile
@uyab
uyab / months-dropdown-bug.php
Created November 2, 2021 22:50
Bug Tanggal Tua
<?php
use Carbon\Carbon;
// Menggenerate array of months: Januari, Februari, Maret, dst
$months = [];
foreach (range(1, 12) as $monthIndex) {
$months[$monthIndex] = Carbon::createFromFormat('m', $monthIndex)->translatedFormat('F');
}
@uyab
uyab / auto-crud.php
Last active October 22, 2021 02:43
Laravolt Auto CRUD configuration file
<?php
// config/laravolt/auto-crud.php
return [
'resources' => [
'user' => [
'label' => 'User',
'model' => \App\Models\User::class,
'schema' => [
@uyab
uyab / multirow.md
Last active January 20, 2020 04:57
Membuat field multirow di Laravolt workflow engine
  1. Buat sebuah field baru di camunda_form dengan field_type = "multirow"
  2. Edit kolom meta, tambahkan value berikut: {"form":"nama_form"}
  3. Buat sebuah file config baru di config/workflow/forms/nama_form.php
  4. Isi config file sesuai standard semantic-form, contohnya bisa dilihat di https://gist.github.com/uyab/7a1bbe0fb676027b146eef824d9ffa94
  5. Buat sebuah tabel baru untuk menyimpan field-field dari multirow tersebut

Contoh

File config/workflow/forms/kronologi.php

php
@uyab
uyab / .zshrc
Created January 16, 2020 00:04
Oh My ZSH Configuration
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$HOME/.composer/vendor/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/uyab/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@uyab
uyab / SampleCommand.php
Last active September 19, 2019 02:29
Laravel command skeleton
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class SampleCommand extends Command
{
/**
* The name and signature of the console command.
@uyab
uyab / imagic-php-brew.sh
Created July 26, 2019 07:22
Install Imagick PHP extension using brew
brew install imagemagick
pecl install imagick
# Dump of table ek_application
# ------------------------------------------------------------
DROP TABLE IF EXISTS `ek_application`;
CREATE TABLE `ek_application` (
`appl_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`appl_reason` varchar(5000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`appl_type` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'see Ekompaun\\Systemconfig\\Enum\\AppealType',
`appl_channel` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'see Ekompaun\\Systemconfig\\Enum\\AppealChannel',
@uyab
uyab / workshop-php.md
Created January 16, 2018 10:30
Catatan Worskhop PHP

Catatan Workshop PHP

Request Peserta

  • package
    • cara bikin package
  • design pattern
  • event listener
  • queue
  • gate vs policy
  • API best practice
    • endpoint (sebagian sudah dibahas ketika bikin routes)
@uyab
uyab / webpack.mix.js
Created October 19, 2017 09:49
Laravel Mix Configuration
let mix = require('laravel-mix');
require('dotenv').config();
const PROXY_URL = process.env.APP_URL || 'localhost';
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
@uyab
uyab / Controller.php
Last active October 18, 2017 23:46
Skinny Controller
<?php
public function store(Request $request)
{
// 1. cek hak akses
// Laravel sudah menyediakan fungsinya, seharusnya tinggal dipanggil
$this->authorize('voucher.add.store');
// 2. membuat direktori, sepertinya bisa dipakai di tempat lain, jadi lebih baik dijadikan helper
create_directory(public_path(date('Ymd')));