Setup LexicalEntry model and new relationships

This commit is contained in:
Leonard Smith 2020-10-06 22:03:25 -05:00
parent a263e62bab
commit 24b4407fe1
2 changed files with 37 additions and 0 deletions

32
app/LexicalEntry.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class LexicalEntry extends Model
{
public $incrementing = false;
public $table = 'lexical_entries';
public $fillable = [
'id',
'lemma',
'commentary',
];
public $visible = [
'id',
'lemma',
'commentary',
];
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function words()
{
return $this->hasMany(Word::class, 'strongs_number');
}
}

View File

@ -34,4 +34,9 @@ class Word extends Model
{
return $this->belongsTo(Word::class);
}
public function lexicalEntry()
{
return $this->belongsTo(LexicalEntry::class, 'id', 'strongs_number');
}
}