Laravel Notes

Useful Resources

  1. Official website
  2. Laravel 5 fundamental tutorials on laracasts
  3. Composer – dependency manager for PHP
    1. click on “Browse Package” to go to packagist.org to search for packages
  4. List of laravel resources – base project, cheat sheet, community etc
  5. Laravel cheat sheet
  6. Laravel cheat sheet 2
  7. Model & migration generator
  8. View generator

Quick notes (I’m using a Mac)

Downloading composer

  1. Run this in terminal
    1. curl -sS https://getcomposer.org/installer | php
  2. Once successful
    1. You got a message
    2. A file composer.phar on current directory
    3. To run the file, type
      1. php composer.phar
  3. Or move to globally accessible directory
    1. mv composer.phar /usr/local/bin/composer
  4. To download a package (example). This download requires Git to be installed
    1. composer require laravel/laravel
    2. wait for composer to download all the packages and update the .json file

Create a laravel project

  1. Run this command on terminal. You better set your current directory to web directory
    1. composer create-project –prefer-dist laravel/laravel blog

Commonly-used Artisan Command

  1. php artisan list (to list all artisan commands available)
  2. php artisan –version (to view laravel version)
  3. php artisan help <command_name> (to view help for a command)
  4. php artisan make
    1. php artisan make:controller <fooController> –resource (create a resource controller with default methods. i.e. index, show, create, store, edit, update, destroy)
    2. php artisan make:model Student –migration (will create a model of student and database migration of students table)
    3. php artisan make:migration create_users_table (will create a migration file in database/migration directory)
  5. php artisan migrate (to migrate database)
    1. php artisan migrate –seed (migrate database and load seeder)
    2. php artisan migrate:status
    3. php artisan migrate:refresh (remove all and remigrate)
    4. more about migration
  6. composer dump-autoload – to regenerate autoload files. especially when error run migrate or db seed. 

Package browsers

  1. packalyst.com (laravel only)
  2. packagist.org (php packages)

Some useful packages/sample applications

  1. laravel admin package – voyager
  2. open source laravel crm – flarepoint

Laravel Homestead and Valet

  1. Haven’t had time to go through yet
  2. Valet is not using vagrant and very simple
  3. Only run on mac

Other resources

  1. Laravel cheat sheet

Leave a Reply

Your email address will not be published. Required fields are marked *