Skip to content

Instantly share code, notes, and snippets.

Get Composer

cd /usr/local/bin
php -r "readfile('https://getcomposer.org/installer');" | php
sudo mv composer.phar composer

Clone the project *make sure git is setup already, refer to previous gist

cd /var/www/

git clone [get the link from bitbucket] # this will clone the repo inside www folder

TODO

Check if apache vhost_alias, rewrite** module is enabled

sudo a2enmod vhost_alias

sudo a2enmod rewrite

restart/reload apache server when prompted >

User.php

//User model

/**
  * Get the password and Hash it before saving to the database.
  *
  * @param     string    $value
  */
 public function setPasswordAttribute($value)

Steps:

  1. Tools
  2. New Snippet
<snippet>
	<content><![CDATA[
Route::get('test', function() {
 // don't convert the tabs into spaces
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;

class DropTables extends Command {

	/**
 * The console command name.
@lozadaOmr
lozadaOmr / User.php
Created January 15, 2015 10:57
Laravel 4.2 User.php
<?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class User extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
@lozadaOmr
lozadaOmr / routes.php
Created January 15, 2015 10:59
Laravel 4.2 routes.php
<?php
Route::get('login', function()
{
// just a shortcut to redirec to /login into /cms/login : prevents redirect LOOP
return Redirect::route('cms.login');
});
Route::group(array('prefix' => 'cms'), function()
{
@lozadaOmr
lozadaOmr / CMSController.php
Created January 15, 2015 11:01
Laravel 4.2 CMSController.php
<?php
class CMSController extends BaseController {
/**
* Display the login page.
* GET /cms
*
* @return Response
*/

Modify the Eloquent model

  1. use SluggableInterface and SluggableTrait
  2. use SluggableTrait (Shorthand to avoid typing the whole path)
  3. create the $sluggable array
  4. important values are build_from and save_to

build_from value is the field Sluggable will convert as a slug, if the title contains this value: 'this is the title' it will save the slug value in the column you specified in save_to field as 'this-is-the-title'