mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-01 04:59:25 -06:00
109 lines
2.4 KiB
PHP
109 lines
2.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Auth\Reminders\RemindableInterface;
|
|
use Illuminate\Auth\Reminders\RemindableTrait;
|
|
use Illuminate\Auth\UserInterface;
|
|
use Illuminate\Auth\UserTrait;
|
|
use Illuminate\Database\Eloquent\Model as Eloquent;
|
|
use Watson\Validating\ValidatingTrait;
|
|
|
|
/**
|
|
* Class User
|
|
*/
|
|
class User extends Eloquent implements UserInterface, RemindableInterface
|
|
{
|
|
|
|
use UserTrait, RemindableTrait, ValidatingTrait;
|
|
|
|
|
|
protected $fillable = ['email'];
|
|
protected $hidden = ['remember_token'];
|
|
protected $rules
|
|
= [
|
|
'email' => 'required|email|unique:users,email',
|
|
'password' => 'required|between:60,60',
|
|
'reset' => 'between:32,32',
|
|
];
|
|
protected $table = 'users';
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function accounts()
|
|
{
|
|
return $this->hasMany('Account');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function bills()
|
|
{
|
|
return $this->hasMany('Bill');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function budgets()
|
|
{
|
|
return $this->hasMany('Budget');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function categories()
|
|
{
|
|
return $this->hasMany('Category');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
|
*/
|
|
public function piggyBanks()
|
|
{
|
|
return $this->hasManyThrough('PiggyBank', 'Account');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function preferences()
|
|
{
|
|
return $this->hasMany('Preference');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function reminders()
|
|
{
|
|
return $this->hasMany('Reminder');
|
|
}
|
|
|
|
/**
|
|
* @param $value
|
|
*/
|
|
public function setPasswordAttribute($value)
|
|
{
|
|
$this->attributes['password'] = Hash::make($value);
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function transactionjournals()
|
|
{
|
|
return $this->hasMany('TransactionJournal');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
|
*/
|
|
public function transactions()
|
|
{
|
|
return $this->hasManyThrough('TransactionJournal', 'Transaction');
|
|
}
|
|
|
|
} |