Laravel Tutorial

Using Laravel:
1) Created database for Laravel, you can see the options in for various database servers on config.php
2) Use any database server and set the parameters on config/database.php and also on the ‘env’ file on the root directory
3) for installing migration “php artisan migrate:install”
4) migrate table gets created
5) to make a migration “php artisan make:migration create_authors_table”
6) on successful creation open migrations, open the created migration
7) create schema in ‘up’ function of the class, drop schema in ‘down’ function
8) Schema query builder is used for creating tables
9) run migrations by using “php artisan migrate”
10) fluent query builder is used for inserting & updating tables
11) DB:: for crud operation into table
12) php artisan migrate:rollback for executing ‘down’ in the migrations (1 step at a time)
13) php artisan migrate:reset for executing ‘down’ on all migrations at once

Advertisements

Laravel Installation

  • Installing Laravel using composer
    Laravel is a PHP framework

    • Open command prompt (Windows)
    • Change directory and go to your webserver root directory (where you put all your website files)
    • Creating a new project in 2 ways:
      1. Execute this command “composer create-project laravel/laravel laravelApp”
      2. execute “laravel new laravelApp”
        1. this only works when laravel is installed globally
    • laravelApp is the new project name, you can your own project name, if the name is not specified new project will be created as laravel (name of the framework)
    • Above command executes laravel framework and all its dependencies
    • You’ll see a secure key provided on the screen on successful installation
    • On successful installation:
      • if you have local server running:
        • Navigate to “yourserver/laravelApp/public” to see welcome page(it shows ‘Laravel’)
      • if you want to use PHP built in environment