firefly-iii/app/User.php

157 lines
5.1 KiB
PHP
Raw Normal View History

<?php
2015-02-05 21:39:52 -06:00
namespace FireflyIII;
2015-02-05 21:39:52 -06:00
use Illuminate\Foundation\Auth\User as Authenticatable;
2016-01-09 01:51:49 -06:00
use Zizaco\Entrust\Traits\EntrustUserTrait;
2015-02-05 22:04:06 -06:00
/**
* Class User
*
* @package FireflyIII
2016-01-15 16:12:52 -06:00
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $email
* @property string $password
* @property string $remember_token
* @property string $reset
* @property boolean $blocked
* @property string $blocked_code
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Bill[] $bills
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Preference[] $preferences
2016-01-11 14:42:51 -06:00
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
2016-01-15 16:12:52 -06:00
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Role[] $roles
2016-02-04 00:22:38 -06:00
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\RuleGroup[] $ruleGroups
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Rule[] $rules
*/
class User extends Authenticatable
{
2016-01-09 01:51:49 -06:00
use EntrustUserTrait;
2015-02-05 22:04:06 -06:00
/**
* The attributes that are mass assignable.
*
* @var array
*/
2015-07-26 08:51:07 -05:00
protected $fillable = ['email', 'password', 'blocked', 'blocked_code'];
2015-02-05 22:04:06 -06:00
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
2015-02-05 22:14:27 -06:00
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
2015-02-05 22:04:06 -06:00
2015-02-11 00:35:10 -06:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2015-02-05 22:04:06 -06:00
public function accounts()
{
2015-02-05 22:35:00 -06:00
return $this->hasMany('FireflyIII\Models\Account');
2015-02-05 22:04:06 -06:00
}
2015-02-05 22:01:24 -06:00
2015-07-18 02:49:19 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function attachments()
{
return $this->hasMany('FireflyIII\Models\Attachment');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2016-01-15 16:12:52 -06:00
public function bills()
{
2016-01-15 16:12:52 -06:00
return $this->hasMany('FireflyIII\Models\Bill');
}
2016-01-12 14:37:48 -06:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2016-01-15 16:12:52 -06:00
public function budgets()
2016-01-12 14:37:48 -06:00
{
2016-01-15 16:12:52 -06:00
return $this->hasMany('FireflyIII\Models\Budget');
2016-01-12 14:37:48 -06:00
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2016-01-15 16:12:52 -06:00
public function categories()
2016-01-12 14:37:48 -06:00
{
2016-01-15 16:12:52 -06:00
return $this->hasMany('FireflyIII\Models\Category');
2016-01-12 14:37:48 -06:00
}
2015-02-11 00:35:10 -06:00
/**
2016-01-15 16:12:52 -06:00
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
2015-02-11 00:35:10 -06:00
*/
2016-01-15 16:12:52 -06:00
public function piggyBanks()
2015-02-05 22:14:27 -06:00
{
2016-01-15 16:12:52 -06:00
return $this->hasManyThrough('FireflyIII\Models\PiggyBank', 'FireflyIII\Models\Account');
2015-02-05 22:14:27 -06:00
}
2015-02-11 00:35:10 -06:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2016-01-15 16:12:52 -06:00
public function preferences()
2015-02-05 22:14:27 -06:00
{
2016-01-15 16:12:52 -06:00
return $this->hasMany('FireflyIII\Models\Preference');
2015-02-05 22:14:27 -06:00
}
2015-02-11 00:35:10 -06:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2016-01-15 16:12:52 -06:00
public function ruleGroups()
2015-02-05 22:14:27 -06:00
{
2016-01-15 16:12:52 -06:00
return $this->hasMany('FireflyIII\Models\RuleGroup');
2015-02-05 22:14:27 -06:00
}
2015-02-11 00:35:10 -06:00
/**
2016-01-15 16:12:52 -06:00
* @return \Illuminate\Database\Eloquent\Relations\HasMany
2015-02-11 00:35:10 -06:00
*/
2016-01-15 16:12:52 -06:00
public function rules()
2015-02-05 22:14:27 -06:00
{
2016-01-15 16:12:52 -06:00
return $this->hasMany('FireflyIII\Models\Rule');
2015-02-05 22:14:27 -06:00
}
2015-03-29 11:28:49 -05:00
/**
2016-01-15 16:12:52 -06:00
* @return \Illuminate\Database\Eloquent\Relations\HasMany
2015-03-29 11:28:49 -05:00
*/
2016-01-15 16:12:52 -06:00
public function tags()
2015-03-29 11:28:49 -05:00
{
2016-01-15 16:12:52 -06:00
return $this->hasMany('FireflyIII\Models\Tag');
2015-03-29 11:28:49 -05:00
}
2015-02-11 00:35:10 -06:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2016-01-15 16:12:52 -06:00
public function transactionjournals()
2015-02-05 22:14:27 -06:00
{
2016-01-15 16:12:52 -06:00
return $this->hasMany('FireflyIII\Models\TransactionJournal');
2015-02-05 22:14:27 -06:00
}
2015-02-11 00:35:10 -06:00
/**
2016-01-15 16:12:52 -06:00
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
2015-02-11 00:35:10 -06:00
*/
2016-01-15 16:12:52 -06:00
public function transactions()
2015-02-05 22:14:27 -06:00
{
2016-01-15 16:12:52 -06:00
return $this->hasManyThrough('FireflyIII\Models\Transaction', 'FireflyIII\Models\TransactionJournal');
2015-02-05 22:14:27 -06:00
}
2015-02-05 21:39:52 -06:00
}