Hello, i want the newsletter to have relationship to hero and header via info
so I can reference $newsletter->hero and $newsletter->header
I am having trouble creating hasOneThrough, please help with conventions.
Note: Newsletter hasOne info. So, Newsletter will have One hero and One Header through Info
Schema::create('infos', function (Blueprint $table) {
$table->id();
$table->foreignUuid('newsletter_id')
->constrained()
->cascadeOnDelete();
$table->foreignIdFor(Hero::class)->nullable();
$table->foreignIdFor(Header::class)->nullable();
$table->timestamps();
});
Schema::create('newsletters', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('name');
$table->timestamps();
});
Schema::create('heroes', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('path');
$table->string('link', 2048);
$table->timestamps();
});
Schema::create('headers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('path');
$table->string('link', 2048);
$table->timestamps();
});