| Total Complexity | 4 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class TestUser extends Model |
||
| 8 | { |
||
| 9 | use \MaksimM\CompositePrimaryKeys\Http\Traits\HasCompositePrimaryKey; |
||
|
|
|||
| 10 | |||
| 11 | protected $table = 'users'; |
||
| 12 | |||
| 13 | protected $primaryKey = [ |
||
| 14 | 'user_id', |
||
| 15 | 'organization_id', |
||
| 16 | ]; |
||
| 17 | |||
| 18 | protected $fillable = [ |
||
| 19 | 'name', 'counter', 'organization_id', 'referred_by_user_id', 'referred_by_organization_id', |
||
| 20 | ]; |
||
| 21 | |||
| 22 | public function organization() |
||
| 23 | { |
||
| 24 | return $this->belongsTo(TestOrganization::class, 'organization_id', 'organization_id'); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function referrer() |
||
| 28 | { |
||
| 29 | return $this->belongsTo(self::class, [ |
||
| 30 | 'referred_by_user_id', |
||
| 31 | 'referred_by_organization_id', |
||
| 32 | ], [ |
||
| 33 | 'user_id', |
||
| 34 | 'organization_id', |
||
| 35 | ]); |
||
| 36 | } |
||
| 37 | |||
| 38 | public function wrongConfiguredReferrer() |
||
| 39 | { |
||
| 40 | return $this->belongsTo(self::class, [ |
||
| 41 | 'referred_by_user_id', |
||
| 42 | 'referred_by_organization_id', |
||
| 43 | ], [ |
||
| 44 | 'user_id', |
||
| 45 | ]); |
||
| 46 | } |
||
| 47 | |||
| 48 | public function automaticReferrer() |
||
| 51 | } |
||
| 52 | } |
||
| 53 |