Skip to content

Instantly share code, notes, and snippets.

View nasrulhazim's full-sized avatar
🎯
Focusing

Nasrul Hazim Bin Mohamad nasrulhazim

🎯
Focusing
View GitHub Profile
@nasrulhazim
nasrulhazim / DashboardMenu.php
Last active January 2, 2020 00:09
Dashboard Menu for Laravel Nova
<?php
namespace NasrulHazim\DashboardMenu;
use Laravel\Nova\Card;
use Laravel\Nova\Nova;
use Illuminate\Support\Str;
class DashboardMenu extends Card
{
@nasrulhazim
nasrulhazim / changelog
Created December 13, 2019 04:13
Generate Change Log in CSV Format using git log
#!/usr/bin/env bash
if [ $# -eq 0 ]
then
echo "Please supply the date. eg. 2019-01-01"
exit 1;
fi
SINCE=$1
UNTIL=$2
@nasrulhazim
nasrulhazim / update-dependencies.sh
Created December 2, 2019 01:50
Update Laravel Application Dependencies
composer update
# can improvise this. If there's new packages, do add and commit.
git add .
git commit -m "Update dependencies"
@nasrulhazim
nasrulhazim / clear-cache.sh
Created December 2, 2019 01:47
Clear All Laravel Caches
rm bootstrap/cache/*.php
composer dumpautoload -o
php artisan reload:cache
@nasrulhazim
nasrulhazim / csfix.sh
Created December 2, 2019 01:45
Apply CS Fixer
vendor/bin/php-cs-fixer fix
# can improvise this to check if there's changes on files, do add. else ignore.
git add .
git commit -m "Apply PHP CS Fixer"
@nasrulhazim
nasrulhazim / init.sh
Created December 2, 2019 01:31
Initialise Laravel Application in Bash Script
#!/bin/bash
composer install
if [ ! -f .env ]; then
cp .env.example .env
php artisan key:generate
else
echo ".env file already created."
fi
@nasrulhazim
nasrulhazim / Base.php
Created November 5, 2019 03:04
Base Model
<?php
namespace App\Models;
use App\Contracts\Datatable as DatatableContract;
use App\Traits\HasDatatable;
use App\Traits\HasMediaExtended;
use App\Traits\SelectOptionTrait;
use App\Traits\WithDetailsTrait;
use Illuminate\Database\Eloquent\Model;
@nasrulhazim
nasrulhazim / RouteServiceProvider.php
Last active September 25, 2022 05:15
Organise Laravel Routes
<?php
collect(
glob(base_path('/routes/web/*.php'))
)->each(function ($path) {
require $path;
});
@nasrulhazim
nasrulhazim / ReloadCacheCommand.php
Created November 5, 2019 02:43
Recache all Laravel caches - `reload:cache`
<?php
namespace App\Console\Commands\Reload;
use Illuminate\Console\Command;
class ReloadCacheCommand extends Command
{
/**
* The name and signature of the console command.
@nasrulhazim
nasrulhazim / create-pdo-informix.md
Last active August 25, 2019 19:12
Create PDO for Informix for MacOS

Download targeted Informix Client SDK

Extract the installer:

$ tar -xvf filename.tar

Install the Client SDK: