2014-06-28 02:41:44 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Auth\Reminders\RemindableInterface;
|
2014-07-05 09:19:15 -05:00
|
|
|
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-06-29 15:12:33 -05:00
|
|
|
{
|
|
|
|
|
2014-12-06 05:12:55 -06:00
|
|
|
use UserTrait, RemindableTrait, ValidatingTrait;
|
2014-06-29 15:12:33 -05:00
|
|
|
|
|
|
|
|
2014-07-05 09:19:15 -05:00
|
|
|
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
|
|
|
|
*/
|
2014-07-05 09:19:15 -05:00
|
|
|
public function accounts()
|
|
|
|
{
|
2014-06-30 00:26:38 -05:00
|
|
|
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-06 10:02:02 -05:00
|
|
|
{
|
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
|
|
|
|
*/
|
2014-12-24 13:55:42 -06:00
|
|
|
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
|
|
|
|
*/
|
2014-07-06 08:18:11 -05:00
|
|
|
public function preferences()
|
|
|
|
{
|
|
|
|
return $this->hasMany('Preference');
|
|
|
|
}
|
|
|
|
|
2014-08-10 11:22:42 -05:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
2014-12-29 13:28:17 -06:00
|
|
|
public function bills()
|
2014-07-15 00:08:13 -05:00
|
|
|
{
|
2014-12-29 13:28:17 -06:00
|
|
|
return $this->hasMany('Bill');
|
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()
|
|
|
|
{
|
2014-07-16 14:11:43 -05:00
|
|
|
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
|
|
|
}
|