Skip to content

Instantly share code, notes, and snippets.

@lozadaOmr
lozadaOmr / Remember Token on Laravel 4.2
Last active August 29, 2015 14:00
After Updating to Laravel 4.2, the User Model when using 'remember me' function for sessions will now require adding a `remember_token` field. And 3 new functions to be added to the User.php
/**
* "First, add a new, nullable remember_token of VARCHAR(100), TEXT, or equivalent to your users table.
* Next, if you are using the Eloquent authentication driver, update your User class with the following three methods:
* See http://laravel.com/docs/upgrade for further details.
*/
public function getRememberToken()
{
return $this->remember_token;
}
@lozadaOmr
lozadaOmr / Route-group Auth Filter
Created April 22, 2014 06:27
Filters all request to routes, checks if user is Authenticated
Route::group(array('before' => 'auth'),function()
{
// Include Routes that can only be accessed when Authenticated here.
});
@lozadaOmr
lozadaOmr / Auth-guest AUTH filter
Created April 22, 2014 06:29
Include on app/filter.php - this is the filter to check if user is Authenticated otherwise will be logged in
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::guest('login');
});
@lozadaOmr
lozadaOmr / README.md
Last active August 29, 2015 14:00 — forked from dergachev/README.md

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@lozadaOmr
lozadaOmr / Laravel post-checkout hook
Last active August 29, 2015 14:00
A simple post-checkout hook, which drops the database, creates it and run migrations and seeding.
#!/bin/bash
user=root
password=root
exec < /dev/tty
clear
while true; do
read -p "Run Migrations[Y/n]: " yn
@lozadaOmr
lozadaOmr / isAdmin Role checker.php
Last active August 29, 2015 14:01
Attach to User model - checks if Auth::user has role 'admin'
/**
*
* Checks whether the User has role of Admin
*
*/
public function isAdmin()
{
$isAdmin = false;
$isAdmin = !$this->roles->filter(function($item) {
return $item->role == 'admin';
sudo apt-get update

sudo apt-get install apache2

sudo apt-get install php5 libapache2-mod-php5 php5-mysql php5-mcrypt php5-gd php5-cli php-pear

sudo apt-get install mysql-server-5.5 mysql-client-5.5
sudo add-apt-repository ppa:ondrej/php5

sudo apt-get update
sudo apt-get install python-software-properties

sudo apt-get update

sudo apt-get install php5

sudo service apache2 restart

@lozadaOmr
lozadaOmr / Git configuration.md
Last active August 29, 2015 14:01
Installing and configuration of GIT

install git

sudo apt-get install git

set username

git config --global user.name "[username]"

example

git config --global user.name "martney"

set email

APACHE

Start apache server

sudo service apache2 start

Stop apache server

sudo service apache2 stop