Page MenuHomePhorge

Tenant.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

Tenant.php

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
/**
* The eloquent definition of a Tenant.
*
* @property int $id
* @property string $title
*/
class Tenant extends Model
{
protected $fillable = [
'id',
'title',
];
protected $keyType = 'bigint';
/**
* Discounts assigned to this tenant.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function discounts()
{
return $this->hasMany('App\Discount');
}
/**
* SignupInvitations assigned to this tenant.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function signupInvitations()
{
return $this->hasMany('App\SignupInvitation');
}
/*
* Returns the wallet of the tanant (reseller's wallet).
*
* @return ?\App\Wallet A wallet object
*/
public function wallet(): ?Wallet
{
$user = \App\User::where('role', 'reseller')->where('tenant_id', $this->id)->first();
return $user ? $user->wallets->first() : null;
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Jun 12, 4:19 AM (10 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
914802
Default Alt Text
Tenant.php (1 KB)

Event Timeline