mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-11-04 06:23:17 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			57 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
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->increments('id');
 | 
						|
            $table->date('invoice_date');
 | 
						|
            $table->date('due_date');
 | 
						|
            $table->string('invoice_number');
 | 
						|
            $table->string('reference_number')->nullable();
 | 
						|
            $table->string('status');
 | 
						|
            $table->string('paid_status');
 | 
						|
            $table->string('tax_per_item');
 | 
						|
            $table->string('discount_per_item');
 | 
						|
            $table->text('notes')->nullable();
 | 
						|
            $table->string('discount_type')->nullable();
 | 
						|
            $table->unsignedBigInteger('discount')->nullable();
 | 
						|
            $table->unsignedBigInteger('discount_val')->nullable();
 | 
						|
            $table->unsignedBigInteger('sub_total');
 | 
						|
            $table->unsignedBigInteger('total');
 | 
						|
            $table->unsignedBigInteger('tax');
 | 
						|
            $table->unsignedBigInteger('due_amount');
 | 
						|
            $table->boolean('sent')->default(false);
 | 
						|
            $table->boolean('viewed')->default(false);
 | 
						|
            $table->string('unique_hash')->nullable();
 | 
						|
            $table->integer('invoice_template_id')->unsigned()->nullable();
 | 
						|
            $table->foreign('invoice_template_id')->references('id')->on('invoice_templates');
 | 
						|
            $table->integer('user_id')->unsigned()->nullable();
 | 
						|
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
 | 
						|
            $table->integer('company_id')->unsigned()->nullable();
 | 
						|
            $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
 | 
						|
            $table->timestamps();
 | 
						|
        });
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Reverse the migrations.
 | 
						|
     *
 | 
						|
     * @return void
 | 
						|
     */
 | 
						|
    public function down()
 | 
						|
    {
 | 
						|
        Schema::dropIfExists('invoices');
 | 
						|
    }
 | 
						|
}
 |