Membuat aplikasi Blog dengan Laravel:
Syarat:
1. Terinstall PHP minimal 7.1.3
2. Webserver (saya gunakan IIS)
Langkah-langkahnya sbb:
1. Install Composer (jika belum tersedia)
2. Jalankan command
3. pada command prompt, masuk ke direktori c:\inetpub\wwwroot\laravel\
c:
cd\inetpub\wwwroot\laravel\
4. masih pada command prompt, ketik:
laravel new blog
5. Buat tabel :
C:\inetpub\wwwroot\laravel\blog>php artisan make:migration create_blog_table
Created Migration: 2018_03_19_053717_create_blog_table
Hasilnya adalah file \database\migrations\2018_03_19_053717_create_blog_table.php
yang berisi perintah untuk membuat tabel.
a. pada bagian public function up()
public function up()
{
Schema::create('blog_post', function
(Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->string('description');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('blog_post');
}
7. Eksekusi:
C:\inetpub\wwwroot\laravel\blog>php artisan migrate
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2018_03_19_053717_create_blog_table
Migrated: 2018_03_19_053717_create_blog_table
Comments
Post a Comment