Changeset View
Changeset View
Standalone View
Standalone View
src/app/Wallet.php
<?php | <?php | ||||
namespace App; | namespace App; | ||||
use App\User; | use App\User; | ||||
use App\Traits\SettingsTrait; | |||||
use Carbon\Carbon; | use Carbon\Carbon; | ||||
use Iatstuti\Database\Support\NullableFields; | use Iatstuti\Database\Support\NullableFields; | ||||
use Illuminate\Database\Eloquent\Model; | use Illuminate\Database\Eloquent\Model; | ||||
/** | /** | ||||
* The eloquent definition of a wallet -- a container with a chunk of change. | * The eloquent definition of a wallet -- a container with a chunk of change. | ||||
* | * | ||||
* A wallet is owned by an {@link \App\User}. | * A wallet is owned by an {@link \App\User}. | ||||
* | * | ||||
* @property integer $balance | * @property integer $balance | ||||
*/ | */ | ||||
class Wallet extends Model | class Wallet extends Model | ||||
{ | { | ||||
use NullableFields; | use NullableFields; | ||||
use SettingsTrait; | |||||
public $incrementing = false; | public $incrementing = false; | ||||
protected $keyType = 'string'; | protected $keyType = 'string'; | ||||
public $timestamps = false; | public $timestamps = false; | ||||
protected $attributes = [ | protected $attributes = [ | ||||
'balance' => 0, | 'balance' => 0, | ||||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | class Wallet extends Model | ||||
* Payments on this wallet. | * Payments on this wallet. | ||||
* | * | ||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany | * @return \Illuminate\Database\Eloquent\Relations\HasMany | ||||
*/ | */ | ||||
public function payments() | public function payments() | ||||
{ | { | ||||
return $this->hasMany('App\Payment'); | return $this->hasMany('App\Payment'); | ||||
} | } | ||||
/** | |||||
* Any (additional) properties of this wallet. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany | |||||
*/ | |||||
public function settings() | |||||
{ | |||||
return $this->hasMany('App\WalletSetting'); | |||||
} | |||||
} | } |