about me
!
›❯ i live in cape town
›❯ i work for http://n.joepublic.co.za
›❯ i love programming
›❯ i have written a book on mvc framework development
›❯ i am finishing a book on laravel applications
Slide 3
Slide 3 text
the disclaimers
!
›❯ much of this is my opinion
›❯ i have a vested interest in the success of laravel
Slide 4
Slide 4 text
laravel
!
›❯ laravel is an mvc framework
›❯ laravel installs with composer
›❯ laravel uses 24 community packages (11 from symfony)
Slide 5
Slide 5 text
artisan
!
›❯ artisan is a command-line utility
›❯ artisan ships with laravel 4
›❯ artisan automates complicated and laborious tasks
Slide 6
Slide 6 text
// terminal
!
›❯ php artisan env
Current application environment: production
!
›❯ php artisan down
Application is now in maintenance mode.
routes
!
›❯ routes link a url to a function
›❯ routes are specified by request method
Slide 9
Slide 9 text
// app/routes.php
!
Route::get("products", function() {
return "show the products";
});
!
Route::post("product", function() {
return "save the product";
});
Slide 10
Slide 10 text
// terminal
!
›❯ php artisan serve
Laravel development server started on http://localhost:8000
!
›❯ curl -X GET "http://localhost:8000/products"
show the products
migrations
!
›❯ migrations are scripted database changes
›❯ migrations have a special dsl
›❯ migrations need to be run
Slide 30
Slide 30 text
// terminal
!
›❯ php artisan migrate:make create_posts_table
Created Migration: 2014_04_01_025625_create_posts_table
Generating optimized class loader
!
›❯ php artisan migrate:make create_users_table
Created Migration: 2014_04_01_025631_create_users_table
Generating optimized class loader
Slide 31
Slide 31 text
// continued...
!
›❯ php artisan migrate:make create_tags_table
Created Migration: 2014_04_01_025656_create_tags_table
Generating optimized class loader
!
›❯ php artisan migrate:make create_posts_tags_table
Created Migration: 2014_04_01_025701_create_posts_tags_table
Generating optimized class loader
Slide 32
Slide 32 text
// app/database/migrations/[timestamp]_create_users_table.php
!
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
!
class CreatePostsTable extends Migration {
...
}
query builder
!
›❯ query builder builds sql queries
›❯ query builder has its own dsl
Slide 41
Slide 41 text
eloquent
!
›❯ eloquent is a programmatic wrapper for database tables
›❯ eloquent is best for single instances
Slide 42
Slide 42 text
authentication
!
›❯ authentication is about blocking the wrong users and allowing
the right ones
›❯ authentication needs a special eloquent model
›❯ alternatives exist