Abo Einmalprodukte und Bestätigung abschließen
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
2bdc9ada3c
commit
2269ce031f
57 changed files with 3647 additions and 371 deletions
32
database/factories/UserAboOneTimeItemFactory.php
Normal file
32
database/factories/UserAboOneTimeItemFactory.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\UserAboOneTimeItem;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<UserAboOneTimeItem>
|
||||
*/
|
||||
class UserAboOneTimeItemFactory extends Factory
|
||||
{
|
||||
protected $model = UserAboOneTimeItem::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_abo_id' => $this->faker->randomNumber(3),
|
||||
'product_id' => $this->faker->randomNumber(3),
|
||||
'comp' => 0,
|
||||
'qty' => $this->faker->numberBetween(1, 5),
|
||||
'price' => $this->faker->randomFloat(2, 5, 100),
|
||||
'price_net' => $this->faker->randomFloat(3, 4, 90),
|
||||
'tax_rate' => 19.00,
|
||||
'tax' => $this->faker->randomFloat(3, 1, 20),
|
||||
'price_vk_net' => $this->faker->randomFloat(3, 4, 90),
|
||||
'discount' => 0,
|
||||
'points' => $this->faker->numberBetween(0, 50),
|
||||
'status' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
|
|
@ -10,6 +11,10 @@ return new class extends Migration
|
|||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('trans_languages')) {
|
||||
return;
|
||||
}
|
||||
|
||||
DB::table('trans_languages')->updateOrInsert(
|
||||
['language' => 'fr'],
|
||||
[
|
||||
|
|
@ -25,6 +30,10 @@ return new class extends Migration
|
|||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('trans_languages')) {
|
||||
return;
|
||||
}
|
||||
|
||||
DB::table('trans_languages')
|
||||
->where('language', 'fr')
|
||||
->delete();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
<?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::create('user_abo_one_time_items', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('user_abo_id');
|
||||
$table->unsignedInteger('product_id');
|
||||
$table->unsignedTinyInteger('comp')->nullable();
|
||||
$table->unsignedInteger('qty');
|
||||
|
||||
$table->decimal('price', 8, 2)->nullable();
|
||||
$table->decimal('price_net', 8, 3)->nullable();
|
||||
$table->decimal('tax_rate', 5, 2)->nullable();
|
||||
$table->decimal('tax', 8, 3)->nullable();
|
||||
$table->decimal('price_vk_net', 8, 3)->nullable();
|
||||
$table->decimal('discount', 5, 2)->nullable();
|
||||
$table->unsignedInteger('points')->nullable();
|
||||
|
||||
$table->unsignedTinyInteger('status')->index()->default(0);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('user_abo_id')
|
||||
->references('id')
|
||||
->on('user_abos')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('product_id')
|
||||
->references('id')
|
||||
->on('products');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_abo_one_time_items');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?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('shopping_order_items', function (Blueprint $table) {
|
||||
$table->boolean('is_abo_addon')->default(false)->after('comp');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('shopping_order_items', function (Blueprint $table) {
|
||||
$table->dropColumn('is_abo_addon');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?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('user_abo_one_time_items', function (Blueprint $table) {
|
||||
$table->unsignedInteger('confirmed_qty')->nullable()->after('qty');
|
||||
$table->timestamp('confirmed_at')->nullable()->after('confirmed_qty');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('user_abo_one_time_items', function (Blueprint $table) {
|
||||
$table->dropColumn(['confirmed_qty', 'confirmed_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue