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 / console.php
Last active November 21, 2016 13:39
Artisan Extended
<?php
Artisan::command('clear:cache', function () {
$this->call('view:clear');
$this->call('config:cache');
$this->call('optimize');
});
Artisan::command('clear:serve', function () {
@nasrulhazim
nasrulhazim / software-development-learning-curve-guidelines.md
Created November 23, 2016 08:17
Software Development Learning Curve Guidelines

Software Development Learning Curve Guidelines

Target Platform

  1. Web Applications
  2. Mobile Applications
  3. Desktop Applications

Tools & Environments

@nasrulhazim
nasrulhazim / console.php
Created November 23, 2016 16:58
Configure Database Connection via Artisan Command in Laravel 5.3
<?php
Artisan::command('splate:database', function () {
// ask database name, default is splate
$connection = $this->ask('What is your connection type?', 'mysql');
$host = $this->ask('What is your database host?', '127.0.0.1');
$port = $this->ask('What is your database port?', 3306);
$database = $this->ask('What is your database name?', 'splate');
$username = $this->ask('What is your database user?', 'root');
$password = $this->secret('What is your database user\'s password?', 'password');

Most active GitHub users in Malaysia

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Mon, 14 Apr 2014 04:55:12 GMT till Tue, 14 Apr 2015 04:55:12 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.location = 'malaysia')
@nasrulhazim
nasrulhazim / actions.blade.php
Last active December 5, 2016 14:17
Reusable Basic Actions Component
<div class="btn-group">
<a href="{{ route($route.'.show', ['id' => $resource->id]) }}" class="btn btn-default">Details</a>
<a href="{{ route($route.'.edit', ['id' => $resource->id]) }}" class="btn btn-primary">Edit</a>
<a href="{{ route($route.'.destroy', ['id' => $resource->id]) }}"
class="btn btn-danger"
onclick="event.preventDefault();
if(confirm('{!! $confirm or 'Are you sure want to delete this record?' !!}')){document.getElementById('action-resource-form-{{ $resource->id }}').submit();}">
Delete
</a>
@nasrulhazim
nasrulhazim / readme.md
Last active December 9, 2016 07:17
Setting up Ajax in Laravel and it's Usage

Add Script Section in Layout

@yield('scripts')

Setup CSRF Token in $.ajaxSetup

jQuery(document).ready(function($) {
@nasrulhazim
nasrulhazim / readme.md
Last active August 30, 2021 01:29
Using Yajra Datatables with Laravel 5.3

Installation

composer require yajra/laravel-datatables-oracle:~6.0

Open up config/app.php and add the following in providers key:

Yajra\Datatables\DatatablesServiceProvider::class,
@nasrulhazim
nasrulhazim / readme.md
Last active December 8, 2016 17:26
Using PHPExcel with Laravel

Installation

composer require maatwebsite/excel

After updating composer, add the ServiceProvider to the providers array in config/app.php

Maatwebsite\Excel\ExcelServiceProvider::class,
@nasrulhazim
nasrulhazim / User.php
Last active December 13, 2016 08:20
Manage Routes
<?php
namespace App\Routes;
use Illuminate\Support\Facades\Route;
/**
* Setup Routes for User
*/
class User
@nasrulhazim
nasrulhazim / ThemeLoader.php
Created December 21, 2016 13:33
Get Data From Response In Laravel's Middleware
<?php
namespace App\Http\Middleware;
use Closure;
use Theme;
class ThemeLoader
{
/**