HomeLaravel

#Part2 laravel 5 Blog Tutorial : Database & Migration

Laravel 5.3 Tutorial for beginners : how to create simple Blog apps using Laravel 5.3 Part2 create Database and migration in laravel 5.3

Laravel 5.3 Tutorial : Login with Linkedin, Google, Twitter & Facebook in Laravel 5.3 Part 4
Laravel 5 Tutorial : Setting Up Laravel 5.3 on Shared Hosting Server
Ebook Tutorial Laravel 5.3 PDF Bahasa Indonesia
Create Blog Apps in Laravel 5 - make simple blog using laravel 5.3 at this lessons will teach us about working with database and crate a migration in Laravel project.

that tutorial was published on previews lessons, pleas read :
  1. How to Connect Database in laravel 5.3
  2. Database Migration & Schema in Laravel 5.3

In this lessons, i assume you must see of the part1 before follow this tutorial, read Introductions to CRUD Operations in laravel 5.3 Part 1

Create Blog using laravel 5.3

Create Database

First, we will need to create a Database (i use MySQL database) in your server. So just create your own database. you can see this tutorial how to make an MySQL database?

Create Laravel Project

with your Terminal (CMD in windows), following this "Artisan CLI" command to create new project in laravel 5.3 :

composer create-project --prefer-dist laravel/laravel web

Intructions :

  1. we will create Laravel project using Composer
  2. web is your project name

Connect with Database

Next, we will create connection with our database, hasbeen posted on How to Connect Database in laravel 5.3

in your .ENV file, modife your connection variable, and configure it with yours.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_blog
DB_USERNAME=root
DB_PASSWORD=

Database Migration

Next, we need to create tables and columns in our database, using Migration in Laravel we will create a table or a columns with very easy, read Database Migration & Schema in Laravel 5.3

laravel 5 Blog Tutorial : Database & Migration

Create migration following by this command :

php artisan make:migration create_blog_table

After success, your migration file will be strored on database\migrations\2016_09_13_113838_crate_blog_table.php

Add some function following by this source code

<?php

use Illuminate\Support\Facades\Schema;
use Illuminat\eDatabase\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CrateBlogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('blog_post', function (Blueprint $table) {
        $table->increments('id');
        $table->string('title');
        $table->string('description');
        $table->timestamps();
      });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('blog_post');
    }
}

Next, execute our migration scheme following by this command :

php artisan migrate

Now, you have a database "laravel_blog", with table name "blog_post" and some column name like, id, title,description, and time stamp in your database.


Video tutorial #Part2 laravel 5 Blog Tutorial : Database & Migration


Next lesson, we will try to show data from database and create a model in laravel 5.3

see you next lessons ...

Feel free to code it up and send us a pull request.

Hi everyone, let's me know how much this lesson can help your work. Please Subscribe and Follow Our Social Media 'kodeajaib[dot]com' to get Latest tutorials and will be send to your email everyday for free!, Just hit a comment if you have confused. Nice to meet you and Happy coding :) all ^^



Follow by E-Mail


COMMENTS

DISQUS
Name

ADO.NET,3,Ajax,6,Android,9,AngularJS,4,ASP.NET,4,Blogger Tutorials,7,Bootstrap,7,C++,1,Codeigniter,2,Cplusplus,6,Crystal Report,6,CSharp,25,Ebook Java,2,FlyExam,1,FSharp,3,Game Development,2,Java,35,JDBC,2,Laravel,89,Lumen,2,MariaDB,2,Ms Access,3,MySQL,31,ODBC,6,OleDB,1,PHP,14,PHP Framework,6,PHP MYSQLI,9,PHP OOP,5,Python,8,Python 3,4,SQL Server,4,SQLite,4,Uncategorized,5,Vb 6,2,Vb.Net,89,Video,48,Vue Js,4,WPF,2,Yii,3,
ltr
item
KODE AJAIB: #Part2 laravel 5 Blog Tutorial : Database & Migration
#Part2 laravel 5 Blog Tutorial : Database & Migration
Laravel 5.3 Tutorial for beginners : how to create simple Blog apps using Laravel 5.3 Part2 create Database and migration in laravel 5.3
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQfmy1gD8Z2bDjsW6MmwLM42H7AFWtZVGHqdcPggnkDNE86k6bzR1f4ykiiKSaJSp76Ol8tJyIFu4NhBsiQ2e2nOme7GOvbJWEXx4GYLmhS9GnDVEGRhgDzAEwolbUA2ke8S21l70cehA/s320/laravel-tutorial-for-beginner.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQfmy1gD8Z2bDjsW6MmwLM42H7AFWtZVGHqdcPggnkDNE86k6bzR1f4ykiiKSaJSp76Ol8tJyIFu4NhBsiQ2e2nOme7GOvbJWEXx4GYLmhS9GnDVEGRhgDzAEwolbUA2ke8S21l70cehA/s72-c/laravel-tutorial-for-beginner.png
KODE AJAIB
https://scqq.blogspot.com/2016/09/laravel-5-blog-tutorial-database-migration.html
https://scqq.blogspot.com/
https://scqq.blogspot.com/
https://scqq.blogspot.com/2016/09/laravel-5-blog-tutorial-database-migration.html
true
3214704946184383982
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy