【文件属性】:
文件名称:belongs-to-through:Laravel雄辩地属于关系
文件大小:7KB
文件格式:ZIP
更新时间:2021-04-23 02:07:37
PHP
介绍
这种逆版本HasManyThrough允许BelongsToThrough无限中级车型的关系。
支持Laravel 5.0+。
安装
composer require staudenmeir/belongs-to-through:"^2.5"
用法
考虑以下HasManyThrough关系: Country →有很多→ User →有很多→ Post
class Country extends Model
{
public function posts ()
{
return $ this -> hasManyThrough ( 'App\Post' , 'App\User' );
}
}
在模型中使用BelongsToThrough特征定义逆关系: Post →属于→ User →属于→ Country
class Post exte
【文件预览】:
belongs-to-through-master
----src()
--------Relations()
--------Traits()
----LICENSE(1KB)
----composer.json(760B)
----README.md(4KB)