Skip to content

Instantly share code, notes, and snippets.

View kholisabdullah's full-sized avatar

Kholis Abdullah kholisabdullah

View GitHub Profile
@kholisabdullah
kholisabdullah / Comment.php
Created August 6, 2019 01:33
Laravel Eloquent Relationship on Multiple Database/Connection
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
public function getConnectionName()
{
@kholisabdullah
kholisabdullah / Discord Bot Python Paginator.MD
Last active April 11, 2018 13:13
Discord Bot Python Paginator with optional numbering

Developed based on Bonfire Paginator

How to use

Download paginator.py in the below.

from paginator import Pages

bot = commands.Bot(command_prefix='.', description=description)

....
@kholisabdullah
kholisabdullah / bot.py
Last active October 26, 2017 14:25
Example Discord Bot, Choosing Choice with Command Extension
import discord
from discord.ext import commands
description = '''An example bot for choosing choice with command extension.'''
bot = commands.Bot(command_prefix='.', description=description)
@bot.event
async def on_ready():
@kholisabdullah
kholisabdullah / bot.py
Created October 24, 2017 15:40
Simple Example to Implement Dynamic Command in Discord Bot
import sys
import discord
from discord.ext import commands
description = '''An example bot with dynamic commands.'''
bot = commands.Bot(command_prefix='?', description=description)
# Simple storage custom command
custom_commands = {'test': 'toast'}
@kholisabdullah
kholisabdullah / app\CustomValidator.php
Created October 14, 2017 07:03
Add Custom Dependent Validator Laravel 5.4 with Custom Validator Class Version
<?php
namespace App\Validators;
use Illuminate\Contracts\Translation\Translator;
use Illuminate\Validation\Validator;
class CustomValidator extends Validator
{
public function __construct(Translator $translator, array $data, array $rules,
@kholisabdullah
kholisabdullah / app\AppServiceProvider.php
Last active October 14, 2017 07:03
Add Custom Dependent Validator Laravel 5.4 Callback Version
<?php
namespace App\Providers;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function boot()