Laravel - my first framework
Free!
With Membership
$7.99
Minimum paid price

Laravel - my first framework

Companion for developers discovering Laravel PHP framework

About the Book

This book answers the following questions that newcomers to Laravel have:

  • Why should I use Laravel?
  • What is Composer?
  • What is routing? 
  • How is MVC used in Laravel applications?
  • What are sessions and how are they used?
  • What is Eloquent ORM and how does it work?

While you read over 200 illustrated pages of the book and code samples you will gain understanding of Laravel framework, its components and concepts behind their usage.

  • Share this book

  • Categories

    • Software

About the Author

Maksim Surguy
Maksim Surguy

Maksim Surguy is a professional breakdancer turned full time web developer. He is the creator, owner and sole developer of Bootsnipp, Panopanda, Builtwithlaravel.com, Bookpages and many more websites. Partnering with Stidges, he created Laravel-tricks.com to help other developers discover tips and tricks for Laravel framework. Maks is an active contributor to the Laravel community and the author of Laravel in Action from Manning Publications.

In his free time he either travels with his wife or creates tutorials on his blog.

You can follow him on Twitter and on his blog to get updates on latest web development news, projects and tutorials.

Table of Contents

  • Introduction
    • About the author
    • Prerequisites
    • Source Code
  • 1. Meeting Laravel
    • 1.1 Introducing Laravel 4 PHP framework
      • 1.1.1 Laravel’s Expressive code
      • 1.1.2 Laravel applications use Model-View-Controller pattern
      • 1.1.3 Laravel was built by a great community
    • 1.2 History of Laravel framework
      • 1.2.1 State of PHP frameworks world before Laravel 4
      • 1.2.2 Evolution of Laravel framework
    • 1.3 Advantages of Using Laravel
      • 1.3.1 Convention over configuration
      • 1.3.2 Ready out of the box
      • 1.3.3 Clear organization of all parts of the application
      • 1.3.4 Built-in Authentication
      • 1.3.5 Eloquent ORM – Laravel’s Active Record implementation
    • 1.4 Summary
  • 2. Getting started for Development with Laravel
    • 2.1 Development overview
    • 2.2 Meeting Composer
    • 2.3 Installing Laravel
    • 2.4 Meeting Artisan: Laravel’s command line interface
    • 2.5 Application structure overview
      • 2.5.1 Files and folders in the root level of the application
      • 2.5.2 Contents of the “app” folder
      • 2.5.3 Configuration settings
    • 2.6 Tutorial: building a website with Laravel
      • 2.6.1 The big picture – development overview
      • 2.6.2 Creating a new Laravel project
      • 2.6.3 Configuring application settings
      • 2.6.4 Specifying endpoints (routes) of the website
      • 2.6.5 Creating the database structure and the model for the data
      • 2.6.6 Filling the database with data
      • 2.6.7 Creating HTML and Blade views
        • 2.6.7.1 Building the layout
        • 2.6.7.2 Building the template for the home page
        • 2.6.7.3 Building the template for the services page
        • 2.6.7.4 Building the template for the contact page
      • 2.6.8 Displaying view templates from the routes
        • 2.6.8.1 Connecting the home page route to the view template
        • 2.6.8.2 Connecting the services page route to the view template
        • 2.6.8.3 Connecting the contact page route to the view template
      • 2.6.9 Adding validation to the contact form
      • 2.6.10 Sending HTML email with Laravel
    • 2.7 Summary
  • 3. Routing
    • 3.1 Introduction to Routing in Laravel
      • 3.1.1 Structure of a basic route
      • 3.1.2 Types of route requests
      • 3.1.3 Routing example: login form
        • 3.1.3.1 Building routing structure for the login form example
        • 3.1.3.2 Showing HTML form and processing user input
    • 3.2 Passing parameters to routes
      • 3.2.1 Using route parameters
        • 3.2.1.1 Passing more than one parameter
      • 3.2.2 Route constraints
      • 3.2.3 Making route parameters optional
    • 3.3 Route Filters
      • 3.3.1 Attaching filters to routes
      • 3.3.2 Creating custom filters
      • 3.3.3 Adding multiple route filters
    • 3.4 Grouping routes
    • 3.5 Route responses
      • 3.5.1 Showing output
      • 3.5.2 Redirects
        • 3.5.2.1 Redirecting to other URLs inside of the application
        • 3.5.2.2 Redirecting to named routes
    • 3.6 Summary
  • 4. Views
    • 4.1 Introducing views and templates
      • 4.1.1 Views - application’s response to a request
      • 4.1.2 Templates in Laravel, Blade
    • 4.2 Creating and organizing views
        • 4.2.0.1 Separating view templates in folders
    • 4.3 Passing data to views
      • 4.3.1 Using “View::make” arguments to pass data
      • 4.3.2 Using method “with”
    • 4.4 Blade template engine
      • 4.4.1 Outputting and escaping data
        • 4.4.1.1 Escaping Data
      • 4.4.2 Using conditional statements and loops
        • 4.4.2.1 Using conditional statements in the views with plain php
        • 4.4.2.2 Using conditional statements in the views with blade
        • 4.4.2.3 Using loops
    • 4.5 Blade layouts
      • 4.5.1 Creating and using a layout
        • 4.5.1.1 Using layouts from views
        • 4.5.1.2 Using method “@yield” to specify placeholders
      • 4.5.2 Using sections
      • 4.5.3 Nesting views by using @include
    • 4.6 Summary
  • 5. Understanding Controllers
    • 5.1 Introducing controllers, the “C” in MVC
    • 5.2 Default Controllers: BaseController and HomeController
      • 5.2.1 Base controller (app/controllers/BaseController.php)
      • 5.2.2 Home controller (app/controllers/HomeController.php)
    • 5.3 Creating controllers
      • 5.3.1 Creating a new controller: LoginController
      • 5.3.2 Creating logic for the LoginController
      • 5.3.3 Defining routing for LoginController
    • 5.4 Using Basic, RESTful and Resource controllers
      • 5.4.1 Creating and using Basic Controllers
      • 5.4.2 Creating and using RESTful Controllers
      • 5.4.3 Creating and using Resource Controllers
        • 5.4.3.1 Creating resource controller with artisan command
    • 5.5 Using controllers with routes
      • 5.5.1 Routing to Basic Controllers
      • 5.5.2 Routing to RESTful Controllers
      • 5.5.3 Routing to Resource Controllers
    • 5.6 Passing route parameters to controllers
      • 5.6.1 Passing parameters to methods of a Basic Controller
      • 5.6.2 Passing parameters to methods of a RESTful Controller
      • 5.6.3 Passing parameters to methods of a Resource Controller
    • 5.7 Using filters with controllers
      • 5.7.1 Attaching filters to a controller
      • 5.7.2 Applying filters to specific methods of a controller
        • 5.7.2.1 Using the “on” keyword
        • 5.7.2.2 Using the “except” and “only” keywords
    • 5.8 Summary
  • 6. Database operations
    • 6.1 Introducing Database Operations in Laravel
      • 6.1.1 Configuring database settings
      • 6.1.2 Introducing Query Builder & Eloquent ORM
        • 6.1.2.1 Query Builder
        • 6.1.2.2 Eloquent ORM
    • 6.2 Using Query Builder
      • 6.2.1 Inserting records
        • 6.2.1.1 Inserting a single record
        • 6.2.1.2 Inserting multiple records
      • 6.2.2 Retrieving records
        • 6.2.2.1 Retrieving a single record
        • 6.2.2.2 Retrieving all records in the table
        • 6.2.2.3 Retrieving specific columns of all records in the table
        • 6.2.2.4 Retrieving a limited number of records
      • 6.2.3 Updating records
        • 6.2.3.1 Updating specific records
        • 6.2.3.2 Updating all records in the table
      • 6.2.4 Deleting records
      • 6.2.5 Deleting specific records
    • 6.3 Filtering, sorting and grouping data
      • 6.3.1 Query Chaining
      • 6.3.2 Using “where” operator to filter data
        • 6.3.2.1 Simple “where” query
        • 6.3.2.2 Using “orWhere” operator
        • 6.3.2.3 Using “whereBetween” operator
      • 6.3.3 Using “orderBy” to sort data
      • 6.3.4 Using “groupBy” to group data
    • 6.4 Using Join Statements
      • 6.4.1 Using Inner Join
      • 6.4.2 Using Left Join
      • 6.4.3 Using other types of Joins
    • 6.5 Summary
  • 7. Eloquent ORM
    • 7.1 Introducing Eloquent ORM
      • 7.1.1 Introducing models
      • 7.1.2 Understanding conventions
    • 7.2 Creating and using models with Eloquent
        • 7.2.0.1 Creating models
        • 7.2.0.2 Using models
      • 7.2.1 Inserting records
      • 7.2.2 Retrieving records
        • 7.2.2.1 Retrieving specific record by using query builder’s operator find()
        • 7.2.2.2 Retrieving first record by using eloquent’s operator first()
        • 7.2.2.3 Retrieving all records from a table using eloquent’s operator all()
        • 7.2.2.4 Using operator get()
      • 7.2.3 Updating records
      • 7.2.4 Deleting records
    • 7.3 Using relationships
      • 7.3.1 One to one relationships
      • 7.3.2 One to Many relationships
      • 7.3.3 Many to Many relationships
      • 7.3.4 Polymorphic relationships
      • 7.3.5 Eager loading relations
    • 7.4 Filtering data
      • 7.4.1 Using query builder
      • 7.4.2 Using query scopes
    • 7.5 Working with retrieved data
      • 7.5.1 Using collections to iterate through data
      • 7.5.2 Converting results
      • 7.5.3 Displaying data
    • 7.6 Overriding conventions
    • 7.7 Summary

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub