feat: Implement payment proof upload for orders, add payment method selection API, and seed bank transfer payment options.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('order', function (Blueprint $table) {
|
||||
$table->string('payment_proof')->nullable()->after('payment_method');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('order', function (Blueprint $table) {
|
||||
$table->dropColumn('payment_proof');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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::rename('order__order_item', 'order_items');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('order_items', 'order__order_item');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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('order_items', function (Blueprint $table) {
|
||||
$table->timestamp('expiry_date')->nullable()->after('months');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->dropColumn('expiry_date');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BankTransferPaymentSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$methods = [
|
||||
[
|
||||
'name' => 'Số dư tài khoản',
|
||||
'type' => 0,
|
||||
'accountNo' => '',
|
||||
'bankName' => '',
|
||||
'bankCode' => '',
|
||||
'logo' => '',
|
||||
'status' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Chuyển khoản ngân hàng',
|
||||
'type' => 1,
|
||||
'accountNo' => '',
|
||||
'bankName' => '',
|
||||
'bankCode' => '',
|
||||
'logo' => '',
|
||||
'status' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Chuyển khoản VNPAY',
|
||||
'type' => 1,
|
||||
'accountNo' => '',
|
||||
'bankName' => 'VNPAY',
|
||||
'bankCode' => 'VNPAY',
|
||||
'logo' => '',
|
||||
'status' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Chuyển khoản ACB',
|
||||
'type' => 1,
|
||||
'accountNo' => '',
|
||||
'bankName' => 'Ngân hàng ACB',
|
||||
'bankCode' => 'ACB',
|
||||
'logo' => '',
|
||||
'status' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Chuyển khoản MB',
|
||||
'type' => 1,
|
||||
'accountNo' => '',
|
||||
'bankName' => 'Ngân hàng MB',
|
||||
'bankCode' => 'MB',
|
||||
'logo' => '',
|
||||
'status' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($methods as $method) {
|
||||
DB::table('payment')
|
||||
->where('name', $method['name'])
|
||||
->exists() ?: DB::table('payment')->insert(array_merge($method, [
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user