Getting started

Install laravel

composer create-project laravel/laravel fdb --prefer-dist

Head over to the Homestead folder, and install the project in Homestead.yaml

folders:
    - map: ~/Google Drive/Sites/laravel/blog
      to: /home/vagrant/blog
    - map: ~/Google Drive/Sites/laravel/larabook
      to: /home/vagrant/larabook
    - map: ~/Google Drive/Sites/laravel/fdb
      to: /home/vagrant/fdb

sites:
    - map: learn.app
      to: /home/vagrant/blog/public
    - map: larabook.app
      to: /home/vagrant/larabook/public
    - map: fdb.app
      to: /home/vagrant/fdb/public

databases:
    - name: learn
    - name: larabook
    - name: fdb

Now to change the hosts file which is in /etc/hosts – add this at the end:

127.0.0.1 fdb.app

Next, if vagrant isn't running you need to run:

vagrant up

to start the server.

Vagrant is already running

You need to run

vagrant provision
* I think this is the best one

I have a weired "No input file specified" warning?

vagrant reload

Congratulations, you should now be able to find the website here!

http://fdb.app:8000/

Vagrant doesn't run

If vagrant doesn't run, there is a good chance that Virtual Box isn't working correctly. The best bet is to Restart it * great fix for Command: ["hostonlyif", "create"] issues

sudo /Library/StartupItems/VirtualBox/VirtualBox restart

When its time to switch off vagrant, run:

vagrant halt

Adding database

You need to create a new database

Set it up. (i.e. just add a new database with the right name in Sequel Pro)
Now just add an .env file. I.e. .env.local.php in the root of your app (next to vendor and app). Fill it up like this:

<?php
return [
    'DB_HOST' => 'localhost',
    'DB_NAME'  => 'entry',
    'DB_USER'  => 'homestead',
    'DB_PASS'  => 'secret',
    'MANDRILL_KEY' => 'XXXXXXXXXXXXXXX',
];

Now go back through and swap out all references to the database password etc with the following

getenv('DB_HOST')

I want to set it up faster

Don't be confused by the local and production environment variable. Just for now, look here:

app/config/local/database.php

Put in the details. They should already be about correct, just update the database name.

Administering

Fire up Sequel pro, add a new favourite and from the menu at the top,

The settings should be along the lines of the below

Name: FDB
Host: 127.0.0.1
Username: homestead
Password: secret
Database: /* database name */
Host: 33060

Pat yourself on the back.

Adding users

We need to add a few migrations, the easiest way by far is using Jeffrey Way's generator class.

https://github.com/JeffreyWay/Laravel-4-Generators

Uploads don't work

  1. Log into Putty and edit nginx.conf by typing:
    sudo vi /etc/nginx/nginx.conf
  2. When in this file, add this line of code within the 'http' block:
    client_max_body_size 8M;
  3. Save the file above by typing:
    :wq
  4. If using Laravel Homestead (Which I am), edit 'php.ini' by typing:
    sudo vi /etc/php5/fpm/php.ini
  5. When in this file, scroll down until you're about 40% into the document and you find the line of code:
    upload_max_filesize = 2M
    Change this code above to:
    upload_max_filesize = 8M
  6. Save the file above by typing:
    :wq
  7. In Putty, type the following commands:
    sudo service nginx restart
    sudo service php5-fpm restart