change workshop table to events
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user