SlideShare a Scribd company logo
All the Laravel things: up
and running to making $$
Joe Ferguson
https://github.com/svpernova09/quickstart-basic-5.3
Who Am I?
Joe Ferguson
PHP Developer
Engineer @ Aol.
Twitter: @JoePFerguson
Organizer of @MemphisPHP
OSMI Board Member
@NomadPHP Lightning Talks
Passionate about Community
For Further Reading
laravelupandrunning.com easylaravelbook.com
Before we begin
Have VirtualBox (virtualbox.org) Installed
Have VirtualBox Extension Pack Installed
Have Vagrant (vagrantup.com) Installed
run: vagrant box add laravel/homestead
Be able to run php from a command line
Setup Your Folder
Clone Repo:
https://github.com/svpernova09/quickstart-basic-5.3
cd quickstart-basic-5.3
composer install
cp .env.example .env
php artisan key:generate
What exactly is Laravel?
Laravel Ecosystem
FrameworkTools
Learning &
Community
Quick note on versions
5.1 LTS bug fixes for 2 years, security fixes for 3 years
Non LTS: bug fixes for 6 months, security fixes for 1 year
5.1 is currently the only LTS version
Which version should you use?
5.3 for my own projects
5.1 for client projects
Getting Laravel
composer global require “laravel/installer”
Installing Laravel
laravel new quickstart-basic-5.3
Install via Composer
composer create-project --prefer-dist laravel/laravel blog
Local Dev Environment
What’s in Homestead
• Ubuntu 16.04
• PHP 7.0
• HHVM
• Nginx
• MySQL
• MariaDB
• Sqlite3
• Postgres
• Composer
• NodeJS
• Bower
• Grunt
• Gulp
• Beanstalkd
• Memcached
• Redis
Getting Homestead
git clone https://github.com/laravel/homestead.git Homestead
Getting Homestead
cd Homestead && bash init.sh
How I use Homestead
composer require —dev laravel/homestead
Make Homestead
./vendor/bin/homested make —aliases
What is —aliases?
Configuring Homestead
Starting Homestead
Inspecting Homestead
Edit /etc/hosts
Optional for per project Homestead
Inspecting Homestead
Inspecting Homestead
Stopping Homestead
Don’t version control
Homestead.yaml
Questions?
Getting Started with Laravel
Project Structure
app Folder
config Folder
database Folder
public Folder
resources Folder
routes Folder
Model Factories
database/factories/ModelFactory.php
User Migration up()
database/migrations
User Migration down()
database/migrations
Database Seeders
Artisan Commands
Artisan Commands
Create Migration
artisan make:migration create_widgets_table
Create Migration
Create Migration
Run Migration(s)
artisan migrate
Inspect the Database
Password is “secret”
Inspect the Database
Create a model
artisan make:model Widget
Widget model
Add Widget ModelFactory
database/factories/ModelFactory.php
Create a seeder
artisan make:seeder WidgetSeeder
WidgetSeeder
DatabaseSeeder
Run Database Seeders
artisan db:seed
Users Table
Widgets Table
Routing
routes/web.php
Why 3 route files?!
Add /widgets Route
localhost:8000/widgets
Frontend Development
Run: npm install
Run: gulp
Compiled Assets
Layouts
Example View
Return a view()
routes/web.php
Refresh /widgets
localhost:8000/widgets
Clean up our layout
Widgets Index View
Pass data to a view
routes/web.php
localhost:8000/widgets
Questions?
Time to do stuff
Open quickstart-basic-5.3
Run: composer install
cp .env.example .env
php artisan key:generate
Run: ./vendor/bin/homestead make —aliases
Run: vagrant up
Run: vagrant ssh
https://github.com/svpernova09/quickstart-basic-5.3
Run: cd quickstart-basic-5.3
Run: artisan migrate
Run: artisan db:seed
Run: npm install
Run: gulp
Exercise 1
Create Migration to create Tasks table
Tasks should have name and user_id fields (and
timestamps())
Create Model for Task
Create Model Factory and Database Seeder for
Tasks
Create tasks view that displays all tasks
Exercise 1 Solution
To see a possible solution
checkout the branch “exercise-1”
git checkout exercise-1
composer dump-auto
Questions?
Testing our Application
Testing our Widgets
Testing our Widgets
Testing our Widgets
Running phpunit
Route Groups
Form Requests
WidgetCreateRequest
HTML Forms
Widget Routes
Add Widget
Test Add Widget Form
Exercise 2
Create view containing a form to add Tasks
Form will have a drop down of users to select
from to assign user’s id to the Task user_id field
Create tests for all new functionality
Exercise 2 Solution
To see a possible solution
checkout the branch “exercise-2”
git checkout exercise-2
composer dump-auto
Questions?
Controllers
Routing to Controllers
Routing to Controllers
Routing to Controllers
Widget Tests Still Pass
Exercise 3
Create TaskController
Move Task logic from web.php to TaskController
Run tests to ensure everything still works
Exercise 3 Solution
To see a possible solution
checkout the branch “exercise-3”
git checkout exercise-3
composer dump-auto
Questions?
Model Relationships
One to One
A User has a Phone Number
One to Many
A Post has many Comments
Many to Many
Users have may Roles
Task belongs to User
User has many Tasks
Query Model
Relationships
The N+1 Problem
Eager Loading
Exercise 4
Implement Eager Loading for Tasks
On the Tasks index view, show the user assigned
Create Users index view, show number of Tasks
each has assigned
Exercise 4 Solution
To see a possible solution
checkout the branch “exercise-4”
git checkout exercise-4
composer dump-auto
Questions?
How do we get it to the
server?
Envoy
Envoy provides easy ways to run command
commands on remote servers such as pulling
code from git, running artisan commands, etc.
Envoy uses blade template syntax
Envoy only supports Mac & Linux
Sample Envoy Config
Sample Envoy Config
Exercise 5
Mock up a Envoy Configuration
Exercise 5 Solution
To see a possible solution
checkout the branch “exercise-5”
git checkout exercise-5
composer dump-auto
Envoy Configuration
Questions?
Easy OAuth Login
Laravel Socialite
Easily allow users to authenticate via Github,
Google, Twitter, Facebook, Bitbucket, or Linkedin
Handles almost all the boilerplate for you
https://github.com/laravel/socialite
composer require
laravel/socialite
Configure Socialite
Configure Socialite
AuthController
Add Socialite Routes
Making $$$
Laravel Cashier
Expressive interface to Stripe and Braintree
subscription billing services
Free, open source package easily added to
Laravel
Designed for subscription, not one off charges
https://laravel.com/docs/5.3/billing
Installing Cashier
Configure Cashier
Cashier Migration
Billable Trait
Stripe API Keys
Subscribing a User
https://laravel.com/docs/5.3/billing
Laravel Spark
SASS in a box
You bring the Service
Spark brings the boilerplate of billing,
authentication, and more
$99 For a single site
$299 For unlimited sites
Laravel Spark
Questions?
Artisan Commands
Create a new Command
Create a new Command
app/Console/Kernel.php
BasicCommand.php
Signature
Description
Constructor
Handle The Command
Running our Command
Output Some Text
Output Some Text
Output Warning Text
Output Warning Text
Output Error Text
Output Error Text
Questions?
Authentication
artisan make:auth
View Files
Auth Routes
Layout :(
Register a new user
Logged In User
Add our Navigation
http://localhost:8000
localhost:8000/widgets
Multiple Middleware
Not Logged In?
Exercise 6
Add Auth to the application
Add navigation to Users, Widgets, and Tasks to
the layout
Make sure to fix the <title> tag in the layout
Run tests to see what is broken
Test Errors and Failure
Run test as a user
Test now passes
Exercise 6 Solution
To see a possible solution
checkout the branch “exercise-6”
git checkout exercise-6
composer dump-auto
Questions?
Feedback!
https://legacy.joind.in/19415
Joe Ferguson
Twitter: @JoePFerguson
Email: joe@joeferguson.me
Freenode: joepferguson
Contact Info:

More Related Content

PDF
Laravel 5 New Features
PDF
MidwestPHP 2016 - Adventures in Laravel 5
PDF
All Aboard for Laravel 5.1
PDF
Knowing Laravel 5 : The most popular PHP framework
PPTX
Intro to Laravel
PPTX
10 Laravel packages everyone should know
PDF
Why Laravel?
PDF
All the Laravel Things – Up & Running to Making $$
Laravel 5 New Features
MidwestPHP 2016 - Adventures in Laravel 5
All Aboard for Laravel 5.1
Knowing Laravel 5 : The most popular PHP framework
Intro to Laravel
10 Laravel packages everyone should know
Why Laravel?
All the Laravel Things – Up & Running to Making $$

What's hot (20)

PDF
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
PPTX
Introduction to Laravel Framework (5.2)
PDF
Digpen 7: Why choose Laravel?
PPTX
Laravel 5
PDF
What's New In Laravel 5
PDF
Web Development with Laravel 5
PPT
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
PDF
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
PDF
php[world] 2015 Training - Laravel from the Ground Up
PPTX
A introduction to Laravel framework
PDF
Laravel Forge: Hello World to Hello Production
PPTX
What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)
PDF
Laravel 5.4
PPTX
Laravel Beginners Tutorial 1
PDF
Getting to know Laravel 5
PDF
Laravel 5 Annotations: RESTful API routing
PDF
Laravel Forge: Hello World to Hello Production
PDF
Console Apps: php artisan forthe:win
PDF
Laravel Introduction
PPTX
Laravel for Web Artisans
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Introduction to Laravel Framework (5.2)
Digpen 7: Why choose Laravel?
Laravel 5
What's New In Laravel 5
Web Development with Laravel 5
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
php[world] 2015 Training - Laravel from the Ground Up
A introduction to Laravel framework
Laravel Forge: Hello World to Hello Production
What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)
Laravel 5.4
Laravel Beginners Tutorial 1
Getting to know Laravel 5
Laravel 5 Annotations: RESTful API routing
Laravel Forge: Hello World to Hello Production
Console Apps: php artisan forthe:win
Laravel Introduction
Laravel for Web Artisans
Ad

Viewers also liked (15)

PDF
Php Dependency Management with Composer ZendCon 2016
PDF
Demystifying Object-Oriented Programming - ZendCon 2016
PPTX
Yeni başlayanlar için Laravel
PDF
Your First Magento 2 Module
PDF
A guide to using eloquent orm in laravel ♥ scotch
PDF
Laravel and Composer
PDF
10 Awesome Websites Built With Laravel Framework
PDF
DB2 and PHP in Depth on IBM i
PPTX
Testing and TDD - Laravel and Express Examples
PDF
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
ODP
Presentation laravel 5 4
PDF
Laravel 5 In Depth
PDF
凌波微步:wagon + VS Code 的輕功哲學
PDF
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)
PDF
[Community Open Camp] 給 PHP 開發者的 VS Code 指南
Php Dependency Management with Composer ZendCon 2016
Demystifying Object-Oriented Programming - ZendCon 2016
Yeni başlayanlar için Laravel
Your First Magento 2 Module
A guide to using eloquent orm in laravel ♥ scotch
Laravel and Composer
10 Awesome Websites Built With Laravel Framework
DB2 and PHP in Depth on IBM i
Testing and TDD - Laravel and Express Examples
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Presentation laravel 5 4
Laravel 5 In Depth
凌波微步:wagon + VS Code 的輕功哲學
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)
[Community Open Camp] 給 PHP 開發者的 VS Code 指南
Ad

Similar to All the Laravel things: up and running to making $$ (20)

PDF
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
PDF
Behavior & Specification Driven Development in PHP - #OpenWest
PDF
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
PDF
Power Of Zero
PPTX
Maven 3 New Features
PDF
Deploying Symfony | symfony.cat
ODP
From Code to Cloud - PHP on Red Hat's OpenShift
PDF
Gerrit linuxtag2011
PDF
ZendCon 2015 - DevOps for Small Teams
PDF
Madison PHP 2015 - DevOps For Small Teams
PPS
Simplify your professional web development with symfony
PPTX
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
PPT
Where's the source, Luke? : How to find and debug the code behind Plone
PPTX
A Fabric/Puppet Build/Deploy System
PDF
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
PPTX
Workshop Laravel 5.2
PDF
Release with confidence
PDF
Midwest PHP 2017 DevOps For Small team
PDF
Software Quality Assurance Tooling - Wintersession 2024
PDF
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Behavior & Specification Driven Development in PHP - #OpenWest
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Power Of Zero
Maven 3 New Features
Deploying Symfony | symfony.cat
From Code to Cloud - PHP on Red Hat's OpenShift
Gerrit linuxtag2011
ZendCon 2015 - DevOps for Small Teams
Madison PHP 2015 - DevOps For Small Teams
Simplify your professional web development with symfony
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
Where's the source, Luke? : How to find and debug the code behind Plone
A Fabric/Puppet Build/Deploy System
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
Workshop Laravel 5.2
Release with confidence
Midwest PHP 2017 DevOps For Small team
Software Quality Assurance Tooling - Wintersession 2024
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY

More from Joe Ferguson (17)

PDF
Modern infrastructure as code with ansible cake fest 2021
PDF
Modern infrastructure as code with ansible PyTN
PDF
Slim PHP when you don't need the kitchen sink
PDF
Throwing Laravel into your Legacy App™
PDF
DevSpace Conf 2017 - Making sense of the provisioning circus
PDF
Release and-dependency-management memphis python
PDF
Composer at Scale, Release and Dependency Management
PDF
Put an end to regression with codeception testing
PDF
Console Apps: php artisan forthe:win
PDF
So You Just Inherited a $Legacy Application… NomadPHP July 2016
PDF
So You Just Inherited a $Legacy Application...
PDF
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
PDF
Secure Form Processing and Protection - Devspace 2015
PDF
Acceptance & Functional Testing with Codeception - Devspace 2015
PDF
Continuous Integration: How I stopped guessing if that merge was bad
PDF
DevOps For Small Teams
PDF
Secure Form Processing and Protection - Sunshine PHP 2015
Modern infrastructure as code with ansible cake fest 2021
Modern infrastructure as code with ansible PyTN
Slim PHP when you don't need the kitchen sink
Throwing Laravel into your Legacy App™
DevSpace Conf 2017 - Making sense of the provisioning circus
Release and-dependency-management memphis python
Composer at Scale, Release and Dependency Management
Put an end to regression with codeception testing
Console Apps: php artisan forthe:win
So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application...
Acceptance & Functional Testing with Codeception - SunshinePHP 2016
Secure Form Processing and Protection - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015
Continuous Integration: How I stopped guessing if that merge was bad
DevOps For Small Teams
Secure Form Processing and Protection - Sunshine PHP 2015

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation theory and applications.pdf
PPTX
Cloud computing and distributed systems.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Electronic commerce courselecture one. Pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
MYSQL Presentation for SQL database connectivity
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Spectral efficient network and resource selection model in 5G networks
Unlocking AI with Model Context Protocol (MCP)
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation theory and applications.pdf
Cloud computing and distributed systems.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
Chapter 3 Spatial Domain Image Processing.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx

All the Laravel things: up and running to making $$