|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Database\Schema\Blueprint; |
|
4
|
|
|
use Illuminate\Database\Migrations\Migration; |
|
5
|
|
|
|
|
6
|
|
|
class PaymentMethodTable extends Migration |
|
7
|
|
|
{ |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Run the migrations. |
|
11
|
|
|
* |
|
12
|
|
|
* @return void |
|
13
|
|
|
*/ |
|
14
|
|
|
public function up() |
|
15
|
|
|
{ |
|
16
|
|
|
Schema::create('payment_method', function (Blueprint $table) { |
|
17
|
|
|
$table->increments('id'); |
|
18
|
|
|
$table->boolean('active')->default(false); |
|
19
|
|
|
$table->integer('shop_id')->unsigned(); |
|
20
|
|
|
$table->foreign('shop_id')->references('id')->on('shop')->onDelete('cascade'); |
|
21
|
|
|
$table->string('title'); |
|
22
|
|
|
$table->boolean('percent_of_total')->default(false); |
|
23
|
|
|
$table->decimal('price', 12, 4)->nullable(); |
|
24
|
|
|
$table->decimal('cost_price', 12, 4)->nullable(); |
|
25
|
|
|
$table->decimal('no_price_from', 12, 4)->nullable(); |
|
26
|
|
|
$table->integer('tax_rate_id')->unsigned()->nullable(); |
|
27
|
|
|
$table->foreign('tax_rate_id')->references('id')->on('tax_rate')->onDelete('set null'); |
|
28
|
|
|
$table->boolean('payment_external')->default(false); |
|
29
|
|
|
$table->enum('mollie_external_payment_way', array('ideal', 'paysafecard', 'creditcard', 'mistercash', 'sofort', 'banktransfer', 'paypal', 'bitcoin', 'belfius'))->nullable(); |
|
30
|
|
|
$table->string('mollie_api_key')->nullable(); |
|
31
|
|
|
|
|
32
|
|
|
$table->enum('total_price_discount_type', array('amount', 'percent'))->nullable(); |
|
33
|
|
|
$table->decimal('total_price_discount_value', 12, 4)->nullable(); |
|
34
|
|
|
$table->date('total_price_discount_start_date')->nullable(); |
|
35
|
|
|
$table->date('total_price_discount_end_date')->nullable(); |
|
36
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
$table->integer('modified_by_user_id')->unsigned()->nullable(); |
|
39
|
|
|
$table->foreign('modified_by_user_id')->references('id')->on('user')->onDelete('set null'); |
|
40
|
|
|
$table->timestamps(); |
|
41
|
|
|
|
|
42
|
|
|
$table->unique(array('title','shop_id'), 'unique_payment_method_title'); |
|
43
|
|
|
}); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Reverse the migrations. |
|
48
|
|
|
* |
|
49
|
|
|
* @return void |
|
50
|
|
|
*/ |
|
51
|
|
|
public function down() |
|
52
|
|
|
{ |
|
53
|
|
|
// |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|