firefly-iii/app/models/User.php

109 lines
2.5 KiB
PHP
Raw Normal View History

2014-06-28 02:41:44 -05:00
<?php
use Illuminate\Auth\Reminders\RemindableInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\UserTrait;
2014-12-06 05:12:55 -06:00
use Watson\Validating\ValidatingTrait;
2014-12-20 08:00:53 -06:00
use \Illuminate\Database\Eloquent\Model as Eloquent;
2014-06-28 02:41:44 -05:00
2014-12-13 14:59:02 -06:00
/**
* Class User
*/
2014-12-06 05:12:55 -06:00
class User extends Eloquent implements UserInterface, RemindableInterface
{
2014-12-06 05:12:55 -06:00
use UserTrait, RemindableTrait, ValidatingTrait;
public static $rules
2014-12-13 14:59:02 -06:00
= [
2014-11-21 04:11:52 -06:00
'email' => 'required|email|unique:users,email',
'password' => 'required|between:60,60',
'reset' => 'between:32,32',
];
2014-12-13 14:59:02 -06:00
protected $fillable = ['email'];
protected $hidden = ['remember_token'];
protected $table = 'users';
2014-06-28 02:41:44 -05:00
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function accounts()
{
return $this->hasMany('Account');
}
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2014-08-09 06:40:13 -05:00
public function budgets()
{
2014-08-09 06:40:13 -05:00
return $this->hasMany('Budget');
}
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2014-08-09 06:40:13 -05:00
public function categories()
{
return $this->hasMany('Category');
}
2014-12-13 14:59:02 -06:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function piggyBanks()
2014-11-12 15:37:44 -06:00
{
2014-12-24 14:20:47 -06:00
return $this->hasManyThrough('PiggyBank', 'Account');
2014-11-12 15:37:44 -06:00
}
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function preferences()
{
return $this->hasMany('Preference');
}
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2014-08-09 06:40:13 -05:00
public function recurringtransactions()
2014-07-15 00:08:13 -05:00
{
2014-08-09 06:40:13 -05:00
return $this->hasMany('RecurringTransaction');
2014-07-15 00:08:13 -05:00
}
2014-11-17 16:08:36 -06:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function reminders()
{
return $this->hasMany('Reminder');
}
2014-08-10 11:22:42 -05:00
/**
* @param $value
*/
2014-08-09 06:40:13 -05:00
public function setPasswordAttribute($value)
2014-07-15 00:08:13 -05:00
{
2014-08-09 06:40:13 -05:00
$this->attributes['password'] = Hash::make($value);
2014-07-15 00:08:13 -05:00
}
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2014-07-30 00:14:00 -05:00
public function transactionjournals()
{
return $this->hasMany('TransactionJournal');
}
2014-12-13 14:59:02 -06:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
2014-11-30 23:09:27 -06:00
public function transactions()
{
return $this->hasManyThrough('TransactionJournal', 'Transaction');
}
2014-07-03 02:43:12 -05:00
}