定制 shomisha/unusual-relationships 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shomisha/unusual-relationships

Composer 安装命令:

composer require shomisha/unusual-relationships

包简介

This package offers a trait which provides your models with the ability to have relationships not included within standard Laravel installations.

README 文档

README

Latest Stable Version Software License Build Status StyleCI Scrutinizer Code Quality

This package is meant to provide its users with an API to accessing relationships that aren't included in Laravel's base installation. It achieves this effect by utilizing a trait which in turn instantiates custom relationship classes which rely on Laravel's relationship scaffolding.

class Employee extends Model {
    public function tasks() 
    {
        return $this->belongsToMany(Task::class);
    }
    
    public function boss() 
    {
        return $this->belongsTo(Boss::class);
    }
}

class Boss extends Model {
    use Shomisha\UnusualRelationships\HasUnusualRelationships;

    public function employees() 
    {
        return $this->hasMany(Employee::class);
    }
    
    public function tasks()
    {
        return $this->belongsToManyThrough(Task::class, Employee::class)
    }
}

The example above shows how you can use the belongsToManyThrough relationship to connect your model to its distantly related models. To learn more about this which methods work with which database structures, as well as how to use those methods, head over to our wiki pages.

统计信息

  • 总下载量: 1.04k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固