| 
									
										
										
										
											2015-02-06 05:35:00 +01:00
										 |  |  | <?php namespace FireflyIII; | 
					
						
							| 
									
										
										
										
											2015-02-06 04:39:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | use Illuminate\Auth\Authenticatable; | 
					
						
							|  |  |  | use Illuminate\Auth\Passwords\CanResetPassword; | 
					
						
							|  |  |  | use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; | 
					
						
							|  |  |  | use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; | 
					
						
							| 
									
										
										
										
											2015-02-06 05:04:06 +01:00
										 |  |  | use Illuminate\Database\Eloquent\Model; | 
					
						
							| 
									
										
										
										
											2015-02-06 04:39:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Class User | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @package FireflyIII | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2015-02-06 05:04:06 +01:00
										 |  |  | class User extends Model implements AuthenticatableContract, CanResetPasswordContract | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     use Authenticatable, CanResetPassword; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * The attributes that are mass assignable. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-02-07 13:15:40 +01:00
										 |  |  |     protected $fillable = ['email', 'password']; | 
					
						
							| 
									
										
										
										
											2015-02-06 05:04:06 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The attributes excluded from the model's JSON form. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     protected $hidden = ['password', 'remember_token']; | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The database table used by the model. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     protected $table = 'users'; | 
					
						
							| 
									
										
										
										
											2015-02-06 05:04:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @return \Illuminate\Database\Eloquent\Relations\HasMany | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-02-06 05:04:06 +01:00
										 |  |  |     public function accounts() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-02-06 05:35:00 +01:00
										 |  |  |         return $this->hasMany('FireflyIII\Models\Account'); | 
					
						
							| 
									
										
										
										
											2015-02-06 05:04:06 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-02-06 05:01:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @return \Illuminate\Database\Eloquent\Relations\HasMany | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     public function bills() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-02-06 05:35:00 +01:00
										 |  |  |         return $this->hasMany('FireflyIII\Models\Bill'); | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @return \Illuminate\Database\Eloquent\Relations\HasMany | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     public function budgets() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-02-06 05:35:00 +01:00
										 |  |  |         return $this->hasMany('FireflyIII\Models\Budget'); | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @return \Illuminate\Database\Eloquent\Relations\HasMany | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     public function categories() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-02-06 05:35:00 +01:00
										 |  |  |         return $this->hasMany('FireflyIII\Models\Category'); | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     public function piggyBanks() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-02-24 21:10:25 +01:00
										 |  |  |         return $this->hasManyThrough('FireflyIII\Models\PiggyBank', 'FireflyIII\Models\Account'); | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @return \Illuminate\Database\Eloquent\Relations\HasMany | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     public function preferences() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-02-06 05:35:00 +01:00
										 |  |  |         return $this->hasMany('FireflyIII\Models\Preference'); | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @return \Illuminate\Database\Eloquent\Relations\HasMany | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     public function reminders() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-02-06 05:35:00 +01:00
										 |  |  |         return $this->hasMany('FireflyIII\Models\Reminder'); | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @return \Illuminate\Database\Eloquent\Relations\HasMany | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     public function transactionjournals() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-02-06 05:35:00 +01:00
										 |  |  |         return $this->hasMany('FireflyIII\Models\TransactionJournal'); | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 07:35:10 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @param $value | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     public function setPasswordAttribute($value) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-02-06 05:35:00 +01:00
										 |  |  |         $this->attributes['password'] = \Hash::make($value); | 
					
						
							| 
									
										
										
										
											2015-02-06 05:14:27 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-06 04:39:52 +01:00
										 |  |  | } |