Promotion Backend v1

This commit is contained in:
Kevin Adametz 2021-10-15 16:35:47 +02:00
parent 0ed47d3553
commit f0da981737
43 changed files with 2765 additions and 45 deletions

View file

@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePromotionAdminsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('promotion_admins', function (Blueprint $table) {
$table->increments('id');
$table->unsignedTinyInteger('type')->default(1);
$table->string('name', 255);
$table->text('description')->nullable();
$table->date('from')->nullable();
$table->date('to')->nullable();
$table->decimal('max_bugdet', 13, 2)->nullable();
$table->unsignedSmallInteger('max_items')->nullable();
$table->boolean('shop')->default(false);
$table->boolean('active')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('promotion_admins');
}
}

View file

@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePromotionAdminProductsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('promotion_admin_products', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('promotion_admin_id')->index();
$table->unsignedInteger('product_id')->index();
$table->boolean('own_price')->default(false);
$table->decimal('price', 8, 2)->nullable();
$table->decimal('tax', 5, 2)->nullable();
$table->decimal('price_old', 8, 2)->nullable(); //streichpreis
$table->boolean('calcu_commission')->default(true);
$table->unsignedSmallInteger('max_items')->nullable();
$table->unsignedSmallInteger('used_items')->nullable();
$table->boolean('shipping')->default(true);
$table->boolean('active')->default(false);
$table->foreign('promotion_admin_id')
->references('id')
->on('promotion_admins');
$table->foreign('product_id')
->references('id')
->on('products');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('promotion_admin_products');
}
}

View file

@ -0,0 +1,56 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePromotionUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('promotion_users', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('promotion_admin_id')->index();
$table->unsignedInteger('user_id');
$table->string('name', 255);
$table->text('description')->nullable();
$table->string('url', 255)->nullable();
$table->boolean('pick_up')->default(true);
$table->decimal('used_budget_total', 13, 2)->nullable();
$table->unsignedSmallInteger('sell_items_total')->nullable();
$table->boolean('active')->default(false);
$table->timestamp('user_deleted_at')->nullable();
$table->timestamps();
$table->foreign('promotion_admin_id')
->references('id')
->on('promotion_admins');
$table->foreign('user_id')
->references('id')
->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('promotion_users');
}
}

View file

@ -0,0 +1,62 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePromotionUserProductsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('promotion_user_products', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('promotion_admin_id')->index();
$table->unsignedInteger('promotion_user_id')->index();
$table->unsignedInteger('promotion_admin_product_id')->index();
$table->unsignedInteger('product_id')->index();
$table->unsignedSmallInteger('open_items')->nullable();
$table->unsignedSmallInteger('sell_items')->nullable();
$table->decimal('used_budget_total', 13, 2)->nullable();
$table->boolean('active')->default(false);
$table->foreign('promotion_admin_id')
->references('id')
->on('promotion_admins');
$table->foreign('promotion_user_id')
->references('id')
->on('promotion_users');
$table->foreign('promotion_admin_product_id')
->references('id')
->on('promotion_admin_products');
$table->foreign('product_id')
->references('id')
->on('products');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('promotion_user_products');
}
}