File: /var/www/html/owlcrm/database/migrations/2024_06_06_042931_create_invoices_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('invoices', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('customer_id')->nullable();
$table->unsignedInteger('lead_id');
$table->unsignedInteger('proposal_id');
$table->string('invoice_number');
$table->timestamp('invoice_date');
$table->timestamp('due_date');
$table->string('tags')->nullable();
$table->string('payment_modes')->nullable();
$table->unsignedInteger('currency');
$table->unsignedInteger('generated_by');
$table->unsignedInteger('agent_id')->nullable();
$table->unsignedTinyInteger('discount_type')->default(0);
$table->float('discount')->default(0);
$table->float('subtotal')->default(0);
$table->float('total')->default(0);
$table->float('adjustment_amount')->default(0);
$table->text('client_note')->nullable();
$table->text('terms_conditions')->nullable();
$table->tinyInteger('is_draft')->default(0);
$table->tinyInteger('status')->comment('paid/unpaid');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('invoices');
}
};