firefly-iii/app/models/User.php

117 lines
2.6 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-06-28 02:41:44 -05:00
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-11-21 04:11:52 -06:00
= [
'email' => 'required|email|unique:users,email',
'password' => 'required|between:60,60',
'reset' => 'between:32,32',
];
protected $fillable = ['email'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
2014-08-06 00:06:45 -05:00
protected $hidden = ['remember_token'];
2014-11-12 15:37:44 -06:00
/**
* The database table used by the model.
*
* @var string
*/
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-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2014-08-09 06:40:13 -05:00
public function components()
{
return $this->hasMany('Component');
}
2014-11-12 15:37:44 -06:00
public function piggybanks()
{
return $this->hasManyThrough('Piggybank', 'Account');
}
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-11-30 23:09:27 -06:00
public function transactions()
{
return $this->hasManyThrough('TransactionJournal', 'Transaction');
}
2014-07-03 02:43:12 -05:00
}