app/Models/Recipe.php: Change getNameAttribute() and getSlugAttribute() to prioritize spell relationship before craft.
This commit is contained in:
parent
21ff933939
commit
8c3a5ddef1
1 changed files with 8 additions and 2 deletions
|
|
@ -123,18 +123,24 @@ class Recipe extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Get recipe name from crafted item.
|
||||
* Get recipe name from crafted item or spell.
|
||||
*/
|
||||
public function getNameAttribute()
|
||||
{
|
||||
if ($this->spell) {
|
||||
return $this->spell->name;
|
||||
}
|
||||
return $this->craft->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get recipe slug from crafted item.
|
||||
* Get recipe slug from crafted item or spell.
|
||||
*/
|
||||
public function getSlugAttribute()
|
||||
{
|
||||
if ($this->spell) {
|
||||
return $this->spell->slug;
|
||||
}
|
||||
return $this->craft->slug;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue