Skip to content

Instantly share code, notes, and snippets.

View crynobone's full-sized avatar
🖥️
Working

Mior Muhammad Zaki crynobone

🖥️
Working
View GitHub Profile
<?php
class Deposit extends OperationBaseModel {
protected $guarded = array();
public static $rules = array(
'deposit_amount' => 'required',
'approval_status' => 'required'
);
}
<?php
class EmailNotifier implements NotifierInterface {
public function send()
{
// send email.
}
}
@crynobone
crynobone / update.sh
Created February 7, 2014 01:08
Laravel project deploy script
cd /var/www/project
composer self-update
php artisan down
rm /var/www/project/bootstrap/compiled.php
git reset --hard
git pull
echo "<?php return \"production\";" > bootstrap/environment.php
composer install --no-dev
find /var/www/project/public/packages -type d -exec chmod 775 {} \;
find /var/www/project/public/packages -type f -exec chmod 664 {} \;
@crynobone
crynobone / install-oci8.sh
Last active October 4, 2019 18:26
Provision Oracle InstantClient for Ubuntu Vagrant.
#!/usr/bin/env bash
export LD_LIBRARY_PATH=/opt/oracle/instantclient
export ORACLE_HOME=/opt/oracle/instantclient
echo "Instantclient path: instantclient,/opt/oracle/instantclient"
sudo pecl install oci8
sudo echo "extension=oci8.so" >> /etc/php5/fpm/php.ini
<?php
use GuzzleHttp\Client;
use Illuminate\Config\Repository;
use Illuminate\Events\Dispatcher;
class ParseNotificationHandler
{
/**
* Config repository.
<?php
/*
Name - templated.php
Author - Shafiq Mustapa (me@shafiqmustapa.my)
Usage - php templated.php
Stumble this upon site (http://templated.co)that offer over 800+ HTML5 + CSS + Responsive.
This php script will download the file automatically. For now, the page is now 7.
Tools
@crynobone
crynobone / composer.json
Last active August 29, 2015 14:21
Parsing Malaysia Public Holiday.
{
"authors": [
{
"name": "crynobone",
"email": "crynobone@gmail.com"
}
],
"require": {
"orchestra/parser": "~3.0"
},

Create a new project.

$ mkdir project
$ cd project

Create a default empty git repository.

$ git init .

Add upstream remote so we can fetch updated setup.

@crynobone
crynobone / UserRoles.php
Last active September 19, 2015 16:11
https://github.com/orchestral/authorization usage outside of Laravel or Orchestra Platform
<?php
class UserRoles implements Orchestra\Contracts\Authorization\Authorizable
{
protected $roles;
public function __construct(array $roles)
{
$this->roles = $roles;
}
<?php
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Queue\SerializableClosure;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
trait SerializesQuery