我想在具有https://regex101.com/r/FZTp5T/5
和mid
的令牌上保存数据
tid
对商家mid
的引用
id
对终端tid
的引用
id
商人hasMany(终端) 终端hasMany(Token)
class Merchant {
public function terminal() {
return $this->hasMany('App\Models\Terminal', 'tid');
}
public function token()
{
return $this->hasMany('App\Models\Token', 'mid');
}
}
class Terminal {
public function merchant() {
return $this->belongsTo(Merchant::class);
}
public function token()
{
return $this->hasMany('App\Models\Token', 'tid');
}
}
class Token {
public function terminal()
{
return $this->belongsTo(Terminal::class);
}
public function merchant()
{
return $this->belongsTo(Merchant::class);
}
}
引发错误:
Merchant
id
mid
Terminal
id
tid
Token
id
mid
tid
token
$merchant_info->terminal->token->save(new Token($data));