Simple Migration – Laravel

Try this simple Laravel migration and avoid using Mysql and others

php artisan make:migration create_tasks_table –create=tasks

<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTasksTable extends Migration
{
    public function up()
    {
        Schema::create('tasks', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::drop('tasks');
    }
}

php artisan make:model Task

<?php
    namespace App;
   use Illuminate\Database\Eloquent\Model;

   class Task extends Model
  {
    //
  }

Leave a Reply

Your email address will not be published. Required fields are marked *