change workshop table to events

This commit is contained in:
2024-05-07 15:00:32 +10:00
parent 391b17c1e7
commit 8f8d12065d
16 changed files with 244 additions and 205 deletions

View File

@@ -3,13 +3,13 @@
namespace Database\Factories;
use App\Models\Location;
use App\Models\Workshop;
use App\Models\Event;
use DateInterval;
use Illuminate\Database\Eloquent\Factories\Factory;
class WorkshopFactory extends Factory
{
protected $model = Workshop::class;
protected $model = Event::class;
public function definition(): array
{

View File

@@ -0,0 +1,37 @@
<?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::rename('workshops', 'events');
Schema::table('tickets', function (Blueprint $table) {
$table->dropForeign(['workshop_id']);
$table->renameColumn('workshop_id', 'event_id');
$table->foreign('event_id')->references('id')->on('events');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::rename('events', 'workshops');
Schema::table('tickets', function (Blueprint $table) {
$table->dropForeign(['event_id']);
$table->renameColumn('event_id', 'workshop_id');
$table->foreign('workshops_id')->references('id')->on('workshops');
});
}
};

View File

@@ -7,7 +7,7 @@ use App\Models\Media;
use App\Models\Post;
use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\Workshop;
use App\Models\Event;
use Database\Factories\LocationFactory;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Storage;