Changeset View
Changeset View
Standalone View
Standalone View
src/app/Tenant.php
Show All 9 Lines | |||||
* | * | ||||
* @property int $id | * @property int $id | ||||
* @property string $title | * @property string $title | ||||
*/ | */ | ||||
class Tenant extends Model | class Tenant extends Model | ||||
{ | { | ||||
use SettingsTrait; | use SettingsTrait; | ||||
protected $fillable = [ | /** @var array<int, string> The attributes that are mass assignable */ | ||||
'id', | protected $fillable = ['id', 'title']; | ||||
'title', | |||||
]; | |||||
/** | /** | ||||
* Utility method to get tenant-specific system setting. | * Utility method to get tenant-specific system setting. | ||||
* If the setting is not specified for the tenant a system-wide value will be returned. | * If the setting is not specified for the tenant a system-wide value will be returned. | ||||
* | * | ||||
* @param int $tenantId Tenant identifier | * @param int $tenantId Tenant identifier | ||||
* @param string $key Setting name | * @param string $key Setting name | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | class Tenant extends Model | ||||
/* | /* | ||||
* Returns the wallet of the tanant (reseller's wallet). | * Returns the wallet of the tanant (reseller's wallet). | ||||
* | * | ||||
* @return ?\App\Wallet A wallet object | * @return ?\App\Wallet A wallet object | ||||
*/ | */ | ||||
public function wallet(): ?Wallet | public function wallet(): ?Wallet | ||||
{ | { | ||||
$user = \App\User::where('role', 'reseller')->where('tenant_id', $this->id)->first(); | $user = User::where('role', 'reseller')->where('tenant_id', $this->id)->first(); | ||||
return $user ? $user->wallets->first() : null; | return $user ? $user->wallets->first() : null; | ||||
} | } | ||||
} | } |