This commit is contained in:
DigitalInfinity committed 2026-06-02 17:11:39 +00:00
1 parent 00bcaa2b93
commit 1559580ceb
37 files changed
+211 -162

No files matched your search

@@ -1,7 +1,7 @@
<?php
use App\Models\User;
use App\Models\Orderstatus;
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -16,11 +16,11 @@ return new class extends Migration
Schema::create('orders', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string("name");
$table->string("url")->nullable();
$table->integer("count")->nullable();
$table->string('name');
$table->string('url')->nullable();
$table->integer('count')->nullable();
$table->foreignidfor(Orderstatus::class)->default(1);
$table->datetime("orderdatetime")->nullable();
$table->datetime('orderdatetime')->nullable();
$table->foreignIdFor(User::class);
});
}
@@ -14,7 +14,7 @@ return new class extends Migration
Schema::create('orderstatuses', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string("name");
$table->string('name');
});
}
@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->boolean("ordermanager")->default(false);
$table->boolean('ordermanager')->default(false);
});
}
@@ -14,8 +14,8 @@ return new class extends Migration
Schema::create('kids', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string("name");
$table->string("email")->nullable();
$table->string('name');
$table->string('email')->nullable();
});
}
@@ -14,8 +14,8 @@ return new class extends Migration
Schema::create('courses', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string("name");
$table->integer("duration");
$table->string('name');
$table->integer('duration');
});
}
@@ -18,7 +18,7 @@ return new class extends Migration
$table->timestamps();
$table->foreignIdFor(Kid::class);
$table->foreignIdFor(Course::class);
$table->date("date")->nullable();
$table->date('date')->nullable();
});
}
@@ -14,7 +14,7 @@ return new class extends Migration
Schema::create('belts', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string("name");
$table->string('name');
});
}
@@ -13,10 +13,12 @@ return new class extends Migration
*/
public function up(): void
{
$ordermanager = Role::firstOrCreate(["name" => "ordermanager", 'title' => 'Ordermanager', 'description' => 'Verwaltet Bestellungen'])->save();
$ordermanager = Role::firstOrCreate(['name' => 'ordermanager', 'title' => 'Ordermanager', 'description' => 'Verwaltet Bestellungen'])->save();
$users = User::all();
foreach($users as $user) {
if($user->ordermanager) $user->roles()->attach($ordermanager);
foreach ($users as $user) {
if ($user->ordermanager) {
$user->roles()->attach($ordermanager);
}
}
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('ordermanager');
@@ -30,11 +32,11 @@ return new class extends Migration
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->boolean("ordermanager")->default(false);
$table->boolean('ordermanager')->default(false);
});
$users = User::all();
foreach($users as $user) {
if($user->hasRole("ordermanager")) {
foreach ($users as $user) {
if ($user->hasRole('ordermanager')) {
$user->ordermanager = 1;
$user->save();
}