2014-06-28 09:41:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Auth\Reminders\RemindableInterface;
|
2014-07-05 16:19:15 +02:00
|
|
|
use Illuminate\Auth\Reminders\RemindableTrait;
|
|
|
|
use Illuminate\Auth\UserInterface;
|
|
|
|
use Illuminate\Auth\UserTrait;
|
2014-12-06 12:12:55 +01:00
|
|
|
use Watson\Validating\ValidatingTrait;
|
2014-06-28 09:41:44 +02:00
|
|
|
|
2014-12-06 12:12:55 +01:00
|
|
|
class User extends Eloquent implements UserInterface, RemindableInterface
|
2014-06-29 22:12:33 +02:00
|
|
|
{
|
|
|
|
|
2014-12-06 12:12:55 +01:00
|
|
|
use UserTrait, RemindableTrait, ValidatingTrait;
|
2014-06-29 22:12:33 +02:00
|
|
|
|
|
|
|
|
2014-07-05 16:19:15 +02:00
|
|
|
public static $rules
|
2014-11-21 11:11:52 +01:00
|
|
|
= [
|
|
|
|
'email' => 'required|email|unique:users,email',
|
|
|
|
'password' => 'required|between:60,60',
|
|
|
|
'reset' => 'between:32,32',
|
|
|
|
];
|
|
|
|
protected $fillable = ['email'];
|
2014-06-29 22:12:33 +02:00
|
|
|
/**
|
|
|
|
* The attributes excluded from the model's JSON form.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2014-08-06 07:06:45 +02:00
|
|
|
protected $hidden = ['remember_token'];
|
2014-11-12 22:37:44 +01:00
|
|
|
/**
|
|
|
|
* The database table used by the model.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $table = 'users';
|
2014-06-28 09:41:44 +02:00
|
|
|
|
2014-08-10 18:22:42 +02:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
2014-07-05 16:19:15 +02:00
|
|
|
public function accounts()
|
|
|
|
{
|
2014-06-30 07:26:38 +02:00
|
|
|
return $this->hasMany('Account');
|
|
|
|
}
|
|
|
|
|
2014-08-10 18:22:42 +02:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
2014-08-09 13:40:13 +02:00
|
|
|
public function budgets()
|
2014-08-06 17:02:02 +02:00
|
|
|
{
|
2014-08-09 13:40:13 +02:00
|
|
|
return $this->hasMany('Budget');
|
|
|
|
}
|
|
|
|
|
2014-08-10 18:22:42 +02:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
2014-08-09 13:40:13 +02:00
|
|
|
public function categories()
|
|
|
|
{
|
|
|
|
return $this->hasMany('Category');
|
|
|
|
}
|
|
|
|
|
2014-08-10 18:22:42 +02:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
2014-08-09 13:40:13 +02:00
|
|
|
public function components()
|
|
|
|
{
|
|
|
|
return $this->hasMany('Component');
|
2014-08-06 17:02:02 +02:00
|
|
|
}
|
|
|
|
|
2014-11-12 22:37:44 +01:00
|
|
|
public function piggybanks()
|
|
|
|
{
|
|
|
|
return $this->hasManyThrough('Piggybank', 'Account');
|
|
|
|
}
|
|
|
|
|
2014-08-10 18:22:42 +02:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
2014-07-06 15:18:11 +02:00
|
|
|
public function preferences()
|
|
|
|
{
|
|
|
|
return $this->hasMany('Preference');
|
|
|
|
}
|
|
|
|
|
2014-08-10 18:22:42 +02:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
2014-08-09 13:40:13 +02:00
|
|
|
public function recurringtransactions()
|
2014-07-15 07:08:13 +02:00
|
|
|
{
|
2014-08-09 13:40:13 +02:00
|
|
|
return $this->hasMany('RecurringTransaction');
|
2014-07-15 07:08:13 +02:00
|
|
|
}
|
|
|
|
|
2014-11-17 23:08:36 +01:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
|
|
|
public function reminders()
|
|
|
|
{
|
|
|
|
return $this->hasMany('Reminder');
|
|
|
|
}
|
|
|
|
|
2014-08-10 18:22:42 +02:00
|
|
|
/**
|
|
|
|
* @param $value
|
|
|
|
*/
|
2014-08-09 13:40:13 +02:00
|
|
|
public function setPasswordAttribute($value)
|
2014-07-15 07:08:13 +02:00
|
|
|
{
|
2014-08-09 13:40:13 +02:00
|
|
|
$this->attributes['password'] = Hash::make($value);
|
2014-07-15 07:08:13 +02:00
|
|
|
}
|
|
|
|
|
2014-08-10 18:22:42 +02:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
2014-07-30 07:14:00 +02:00
|
|
|
public function transactionjournals()
|
|
|
|
{
|
2014-07-16 21:11:43 +02:00
|
|
|
return $this->hasMany('TransactionJournal');
|
|
|
|
}
|
|
|
|
|
2014-12-01 06:09:27 +01:00
|
|
|
public function transactions()
|
|
|
|
{
|
|
|
|
return $this->hasManyThrough('TransactionJournal', 'Transaction');
|
|
|
|
}
|
|
|
|
|
2014-07-03 09:43:12 +02:00
|
|
|
}
|