public function words()
{
return $this->belongsToMany('App\Word', definition_word)->withTimestamps();
}
Use this:
With a variable $table
we can use words()
function to the different tables.
public function words($table = null)
{
return $this->belongsToMany('App\Word', $table)->withTimestamps();
}