<?php


/**
 * Author: Emmanuel Paul Mnzava
 * Twitter: @epmnzava
 * Github:https://github.com/dbrax/bill-me
 * Email: epmnzava@gmail.com
 * 
 */

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

class CreateInvoicesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('invoices', function (Blueprint $table) {
            $table->bigIncrements('id');

              //if the user has loggin you can save the user id
            $table->integer('userid')->nullable();
            $table->string('orderid'); //required attribute
            $table->bigInteger("amount")->nullable();//required attribute
            $table->string('firstname'); //required attribute
            $table->string('lastname')->nullable();
            $table->string('mobile_number')->nullable();
            $table->string('email'); // required attribute
            $table->string('status')->default('pending');
            $table->string('address')->nullable();
            $table->string('invoice_type')->nullable();
            $table->string('notes')->nullable(); // if any notes
            $table->string('invoice_title')->nullable(); // if the invoice has a title
            $table->date("date"); //initiated date
            $table->date("due_date")->nullable(); //not required in some usecase
            $table->string('payment_method')->nullable();






            $table->timestamps();
        });
    }

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