Laravel 5 notes

  1. when setting up vhost, set the document root to 'directory/laravel-app-root/public'
  2. after composer create-project laravel/laravel your-project-name --prefer-dist or laravel new your-project-name , if white screen no error, change the storage folder to 775
  3. To start creating controllers, use artisan command line tool, like this: php artisan make:controller PagesController  or a blank controller with the flag '--plain' php artisan make:controller PagesController --plain
  4. View files are stored at: resources/views
  5. Name view files "xxxx.blade.php" to utilise laravel's blade render engine
  6.  passing variables to views: use view('pages.about')->with($key,$value) or ->with($array_variables_in_key_value_pairs)
  7. use php artisan make:migration create_content_table --create="content" to create new migration file, under database/migrations folder
  8. php artisan migrate to migrate the database

  9. when setting up .env file, if need to connect to remote database, use the IP address rather than the domain name for the server.
  10. Database table name need an 's' at the end if using the default model setup, ie. Article model is associated with 'articles' table
  11. composer require illuminate/html to utilise html template assistance. (ServiceProvider) suggests that the library is laravel compatible.

  12. routes.php when defining wildcard like get('contents/{id}', 'ContentController@show'), make sure wildcards get defined last so that it does not overrides the routing defined below it.

Get In Touch

Like what you've seen so far?
Find out what I can do for you simply by filling out the contact form, or via the following social media sites.