Saturday, June 3, 2017

Laravel From Scratch 1

.

.

INTRODUCTION TO LARAVEL



What Is Laravel?
• Open Source PHP Framework
• Aims to make dev process pleasing without sacrificing quality
• One of the most popular and respected PHP frameworks
• Uses The MVC (Model View Controller) Design Pattern


What Is Included In This Series?
• Laravel Overview
• Installation / Setup
• Build a Website & Blog Application
• Authentication & Access Control
• Deploying a Laravel Application

AFTER THIS SERIES:
10 Project Laravel Course
• Basic Website
• Todo List
• Business Listings App
• Photo Gallery
• REST API
• OctoberCMS Website
• Twitter API App
• Bookmark Manager
• Contacts Manager With Vue.js
• Backpack Site Manager

What Does Laravel Do?
• Route Handling
• Security Layer
• Models & DB Migrations
• Views/ Templates
• Authentication
• Sessions
• Compile Assets
• Storage & File Management
• Error Handling
• Unit Testing
• Email & Config
• Cache Handling


Installing Laravel
Laravel is installed using Composer
• Download composer from http://getcomposer.org
• Install Composer
composer create-project laravel/laravel myapp
• Add V-Hosts and hosts file entry

Artisan CLI
Laravel includes the Artisan CLI which handles many tasks
• Creating controllers & models
• Creating database migration files and running migrations
• Create providers, events, jobs, form requests, etc
• Show routes
• Session commands
• Run Tinker
• Create custom commands

Examples of Artisan Commands
$ php artisan list
$ php artisan help migrate
$ php artisan make:controller TodosController
$ php artisan make:model Todo —m
$ php artisan make:migration add todos_to_db —table=todos
$ php artisan migrate
$ php artisan tinker


Eloquent ORM
Laravel includes the Eloquent object relational mapper
• Makes querying & working with the DB very easy
• We can still use raw SQL queries if needed
Use App\Todo;
$todo = new Todo;
$todo->title = 'Some Todo';
$todo->save();


Blade Template Engine
• Simple & powerful
• Control structures (if else, loops, etc)
• Can use <?php echo 'PHP Tags'; ?>
• Can create custom components
• Template Inheritance: Extend layouts easily


<!-- Stored in resources/views/layouts/app.blade.php -->
<html>
<head>
<title>App Name - @yield('title')</title>
</head>
</body>
@section('sidebar')
This is the master sidebar.
@show
<div class="container">
@yield('content' )
</div>
</html>


<!-- Stored in resources/views/child.blade.php -->
@extends('layouts.app')
@section('title','Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<p>This is my body content. </p>
@endsection

FOLLOW:
Youtube.com/c/traversymedia
Facebook.com/traversymedia
Twitter.com/c/traversymedia

SUPPORT:
Patreon.com/traversymedia
Paypal.me/traversymedia
.

NEXT: Laravel From Scratch 2

No comments:

Post a Comment

Labels