mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-18 10:44:08 +00:00
Add expense number at Expenses (#406)
* add expense number at expenses * Re-order expense fields * Rename expense_number migration * Add expense_number to tests --------- Co-authored-by: Darko Gjorgjijoski <dg@darkog.com>
This commit is contained in:
committed by
GitHub
parent
f3e49d3044
commit
3e96297699
@@ -26,6 +26,7 @@ class ExpenseFactory extends Factory
|
||||
return [
|
||||
'expense_date' => $this->faker->date('Y-m-d', 'now'),
|
||||
'expense_category_id' => ExpenseCategory::factory(),
|
||||
'expense_number' => $this->faker->unique()->numerify('EXP-#####'),
|
||||
'company_id' => User::find(1)->companies()->first()->id,
|
||||
'amount' => $this->faker->randomDigitNotNull(),
|
||||
'notes' => $this->faker->text(),
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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::table('expenses', function (Blueprint $table) {
|
||||
$table->string('expense_number')->nullable()->after('expense_date');
|
||||
$table->index('expense_number');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->dropIndex(['expense_number']);
|
||||
$table->dropColumn('expense_number');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user