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-31 07:43:33 +01:00
|
|
|
use Illuminate\Database\Eloquent\Model as Eloquent;
|
2014-12-06 12:12:55 +01:00
|
|
|
use Watson\Validating\ValidatingTrait;
|
2014-06-28 09:41:44 +02:00
|
|
|
|
2014-12-13 21:59:02 +01:00
|
|
|
/**
|
|
|
|
* Class User
|
|
|
|
*/
|
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-12-31 07:43:33 +01:00
|
|
|
protected $fillable = ['email'];
|
|
|
|
protected $hidden = ['remember_token'];
|
2014-12-31 00:57:12 +01:00
|
|
|
protected $rules
|
2014-12-31 07:43:33 +01:00
|
|
|
= [
|
2014-11-21 11:11:52 +01:00
|
|
|
'email' => 'required|email|unique:users,email',
|
|
|
|
'password' => 'required|between:60,60',
|
|
|
|
'reset' => 'between:32,32',
|
|
|
|
];
|
2014-12-13 21:59:02 +01:00
|
|
|
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-12-31 07:43:33 +01:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
|
|
|
public function bills()
|
|
|
|
{
|
|
|
|
return $this->hasMany('Bill');
|
|
|
|
}
|
|
|
|
|
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-12-13 21:59:02 +01:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
|
|
|
*/
|
2014-12-24 20:55:42 +01:00
|
|
|
public function piggyBanks()
|
2014-11-12 22:37:44 +01:00
|
|
|
{
|
2014-12-24 21:20:47 +01:00
|
|
|
return $this->hasManyThrough('PiggyBank', 'Account');
|
2014-11-12 22:37:44 +01:00
|
|
|
}
|
|
|
|
|
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-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
|
|
|
|
2015-01-02 06:16:49 +01:00
|
|
|
}
|