Skip to content

Instantly share code, notes, and snippets.

# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name
cd project-name
git checkout --orphan master
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
# Fix merge conflicts if any and commit
@gravitano
gravitano / BaseRepository.php
Created March 29, 2014 04:30
Simple repository extended.
<?php namespace Smile\Repositories;
use App;
class BaseRepository
{
protected $model;
public function __construct()
{
@gravitano
gravitano / UsersController.php
Last active August 29, 2015 13:57
Kalo mau find data via Model/Eloquent, mending pake `findOrFail` aja, nanti tinggal di try and catch, ini contohnya.
<?php
use Illuminate\Database\Eloquent\ModelNotFoundException;
class UsersController extends Controller
{
/**
* Remove the specified resource from storage.
*
* @param int $id
@gravitano
gravitano / Creator.php
Last active August 29, 2015 13:57
Kelas sederhana untuk mempermudah proses validation saat pengimputan data atau update data.
<?php namespace Smile\Services\Creators;
use Illuminate\Validation\Factory as Validator;
abstract class Creator implements CreatorInterface
{
protected $model;
protected $errors;
@gravitano
gravitano / global.php
Created March 28, 2014 07:23
404 Error Handling on Laravel 4
App::missing(function()
{
if(Request::ajax())
{
return Response::json([
'code' => 404,
'message' => 'Sorry, that page does not exists.'
], 404);
}
return Response::view('404', [], 404);
@gravitano
gravitano / BaseController.php
Created March 27, 2014 14:00
Simple trick for your BaseController.php
<?php
class BaseController extends Controller {
/**
* Setup the layout used by the controller.
*
* @return void
*/
protected function setupLayout()
@gravitano
gravitano / install.sh
Last active August 29, 2015 13:57 — forked from JeffreyWay/install.sh
LAMP on Ubuntu 14.04
sudo apt-get update
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
sudo apt-get install -y vim curl python-software-properties
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo add-apt-repository ppa:git-core/ppa
@gravitano
gravitano / .vimrc
Last active August 29, 2015 13:57
My ~/.vimrc file :D
execute pathogen#infect()
syntax on
filetype plugin indent on
" CtrlP Stuff
set runtimepath^=~/.vim/bundle/ctrlp.vim
set encoding=utf-8
let g:ctrl_max_height=20
set wildignore+=*.pyc
set wildignore+=_build/*
@gravitano
gravitano / .vimrc
Created March 17, 2014 15:42 — forked from JeffreyWay/.vimrc
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
<?php
/*
|--------------------------------------------------------------------------
| Detect The Application Environment
|--------------------------------------------------------------------------
|
| Laravel takes a dead simple approach to your application environments
| so you can just specify a machine name for the host that matches a
| given environment, then we will automatically detect it for you.