Skip to content

Instantly share code, notes, and snippets.

@EricMcWinNer
Created December 2, 2020 23:27
Show Gist options
  • Save EricMcWinNer/a9c5d249dea6477f3f34a0eae24c6767 to your computer and use it in GitHub Desktop.
Save EricMcWinNer/a9c5d249dea6477f3f34a0eae24c6767 to your computer and use it in GitHub Desktop.
Define the relationship
<?php
// app/Models/Word.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Word extends Model
{
use HasFactory;
// Define the One to One Relationship
public function match() {
return $this->hasOne(Match::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment