Skip to content

Instantly share code, notes, and snippets.

@lloydroc
Last active November 29, 2016 05:19
Show Gist options
  • Save lloydroc/c2a0e8e803a8e9a5117d53c6938caa1b to your computer and use it in GitHub Desktop.
Save lloydroc/c2a0e8e803a8e9a5117d53c6938caa1b to your computer and use it in GitHub Desktop.
Laravel Install Notes
# From https://laravel.com/docs/5.3#installing-laravel
composer global require "laravel/installer" # then add $HOME/.composer/vendor/bin to your path
#source your shell rc file to pick up the laravel binary
laravel new example_project
# Dev environment can be Homestead (runs off virtualbox) or Valet (OS X only) for minimalists running the caddy server
# now make some controllers
php artisan make:controller ControllerName
# Add some vendor dependencies
composer require bob/montana
# Remove some vendor dependencies
composer remove bob/montana
# run the migrations
php artisan migrate
php artisan rollback
php artisan make:migation create_x_table --create="tablename"
php artisan make:migration update_x_table --table="tablename" # no we can add columns in up and remove in down
# may need a composer package doctrine/dbal to remove columns
# models
php artisan make:model Article
php artisan tinker
# use dd($var) method to show a variable
# forms
composer require illimunate/html
# Best way to create a new model
php artisan make:model SecDoc --migration
# Fill in the migration schema with the needed columns
# From homestead do a
php artisan migrate
# Test it from inside homestead do a
php artisan tinker
>>> t = App\SecDoc::create(['type' => '10-K', 'url' => 'http://abc.com'])
# After installing mysql
CREATE DATABASE homestead;
CREATE USER 'homestead'@'localhost' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON homestead.* to 'homestead'@'localhost';
# See https://laracasts.com/series/laravel-5-fundamentals/episodes/10 for form generator install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment