Merge branch 'dillon/63.2-sorry-voucher' into 'master'

Sorry Voucher Implementation

See merge request CIEFWorldwideSdnBhd/exchange-2.0!166
This commit is contained in:
Dillon Ngo
2024-08-03 15:09:34 +00:00
140 changed files with 1432 additions and 198 deletions
@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateVoucherCampaignsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('voucher_campaigns', function (Blueprint $table) {
$table->id();
$table->string('campaign_id');
$table->string('name');
$table->string('slug')->unique();
$table->text('description')->nullable();
$table->integer('limit_per_month')->default(0);
$table->boolean('is_display')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('voucher_campaigns');
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddVoucherCampaignIdToVouchersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('vouchers', function (Blueprint $table) {
$table->foreignId('voucher_campaign_id')->nullable()->constrained('voucher_campaigns')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('vouchers', function (Blueprint $table) {
$table->dropForeign(['voucher_campaign_id']);
$table->dropColumn('voucher_campaign_id');
});
}
}
@@ -71,6 +71,8 @@ class AdminUserPermissionsTableSeeder extends Seeder
['name' => 'delete milestone', 'guard_name' => 'web'],
['name' => 'delete reward', 'guard_name' => 'web'],
['name' => 'add voucher', 'guard_name' => 'web'],
['name' => 'list voucher campaigns', 'guard_name' => 'web'],
];
foreach ($permissions as $permission){