mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Voucherify phase 2
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRewardsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('rewards', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->integer('type')->default(0);
|
||||
$table->string('value');
|
||||
$table->integer('order')->default(9999);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('rewards');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMilestonesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('milestones', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('description');
|
||||
// $table->unsignedBigInteger('reward_id');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
// $table->foreign('reward_id')->references('id')->on('rewards')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('milestones');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMilestoneProgressTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('milestone_progress', function (Blueprint $table) {
|
||||
$table->id();
|
||||
// $table->unsignedBigInteger('company_id');
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->unsignedBigInteger('milestone_id');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
// $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('milestone_id')->references('id')->on('milestones')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('milestone_progress');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUserRewardsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_rewards', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->unsignedBigInteger('reward_id');
|
||||
$table->unsignedBigInteger('voucher_id');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
// $table->foreign('reward_id')->references('id')->on('rewards')->onDelete('cascade');
|
||||
$table->foreign('voucher_id')->references('id')->on('vouchers')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('user_rewards');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMilestoneReward extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('milestone_reward', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('milestone_id');
|
||||
$table->unsignedBigInteger('reward_id');
|
||||
// $table->timestamps();
|
||||
|
||||
$table->foreign('milestone_id')->references('id')->on('milestones')->onDelete('cascade');
|
||||
$table->foreign('reward_id')->references('id')->on('rewards')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('milestone_reward');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateVoucherEntityMappings extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('voucher_entity_mappings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('owner_type');
|
||||
$table->unsignedBigInteger('owner_id');
|
||||
$table->string('voucherify_entity_type');
|
||||
$table->string('voucherify_entity_id');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('voucher_entity_mappings');
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddStartDateAndEndDateToVouchersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('vouchers', function (Blueprint $table) {
|
||||
$table->timestamp('start_date')->nullable();
|
||||
$table->timestamp('end_date')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('vouchers', function (Blueprint $table) {
|
||||
$table->dropColumn(['start_date', 'end_date']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ class AdminUserPermissionsTableSeeder extends Seeder
|
||||
app()['cache']->forget('spatie.permission.cache');
|
||||
|
||||
// admin permissions
|
||||
$permissions = [
|
||||
$permissions = [
|
||||
['name' => 'view document', 'guard_name' => 'web'],
|
||||
['name' => 'add document', 'guard_name' => 'web'],
|
||||
['name' => 'edit document', 'guard_name' => 'web'],
|
||||
@@ -63,7 +63,14 @@ class AdminUserPermissionsTableSeeder extends Seeder
|
||||
['name' => 'view booking', 'guard_name' => 'web'],
|
||||
['name' => 'add booking', 'guard_name' => 'web'],
|
||||
['name' => 'edit booking', 'guard_name' => 'web'],
|
||||
['name' => 'delete booking', 'guard_name' => 'web']
|
||||
['name' => 'delete booking', 'guard_name' => 'web'],
|
||||
|
||||
['name' => 'add milestone', 'guard_name' => 'web'],
|
||||
['name' => 'add reward', 'guard_name' => 'web'],
|
||||
['name' => 'edit milestone', 'guard_name' => 'web'],
|
||||
['name' => 'delete milestone', 'guard_name' => 'web'],
|
||||
['name' => 'delete reward', 'guard_name' => 'web'],
|
||||
|
||||
];
|
||||
|
||||
foreach ($permissions as $permission){
|
||||
|
||||
Reference in New Issue
Block a user