firefly-iii/app/User.php

169 lines
5.1 KiB
PHP
Raw Normal View History

<?php
2016-02-05 05:08:25 -06:00
declare(strict_types = 1);
2015-02-05 21:39:52 -06:00
namespace FireflyIII;
2015-02-05 21:39:52 -06:00
2016-02-06 03:11:06 -06:00
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
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
2016-02-04 10:14:59 -06:00
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\ExportJob[] $exportjobs
*/
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
/**
2016-02-06 03:11:06 -06:00
* @return HasMany
2015-02-11 00:35:10 -06:00
*/
2016-02-06 03:11:06 -06:00
public function accounts(): HasMany
2015-02-05 22:04:06 -06:00
{
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
/**
2016-02-06 03:11:06 -06:00
* @return HasMany
2015-07-18 02:49:19 -05:00
*/
2016-02-06 03:11:06 -06:00
public function attachments(): HasMany
2015-07-18 02:49:19 -05:00
{
return $this->hasMany('FireflyIII\Models\Attachment');
}
/**
2016-02-06 03:11:06 -06:00
* @return HasMany
*/
2016-02-06 03:11:06 -06:00
public function bills(): HasMany
{
2016-01-15 16:12:52 -06:00
return $this->hasMany('FireflyIII\Models\Bill');
}
2016-01-12 14:37:48 -06:00
/**
2016-02-06 03:11:06 -06:00
* @return HasMany
2016-01-12 14:37:48 -06:00
*/
2016-02-06 03:11:06 -06:00
public function budgets(): HasMany
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
}
/**
2016-02-06 03:11:06 -06:00
* @return HasMany
2016-01-12 14:37:48 -06:00
*/
2016-02-06 03:11:06 -06:00
public function categories(): HasMany
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
}
2016-02-04 10:14:59 -06:00
/**
2016-02-06 03:11:06 -06:00
* @return HasMany
2016-02-04 10:14:59 -06:00
*/
2016-02-06 03:11:06 -06:00
public function exportjobs(): HasMany
2016-02-04 10:14:59 -06:00
{
return $this->hasMany('FireflyIII\Models\ExportJob');
}
2015-02-11 00:35:10 -06:00
/**
2016-02-06 03:11:06 -06:00
* @return HasManyThrough
2015-02-11 00:35:10 -06:00
*/
2016-02-06 03:11:06 -06:00
public function piggyBanks(): HasManyThrough
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
/**
2016-02-06 03:11:06 -06:00
* @return HasMany
2015-02-11 00:35:10 -06:00
*/
2016-02-06 03:11:06 -06:00
public function preferences(): HasMany
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
/**
2016-02-06 03:11:06 -06:00
* @return HasMany
2015-02-11 00:35:10 -06:00
*/
2016-02-06 03:11:06 -06:00
public function ruleGroups(): HasMany
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-02-06 03:11:06 -06:00
* @return HasMany
2015-02-11 00:35:10 -06:00
*/
2016-02-06 03:11:06 -06:00
public function rules(): HasMany
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-02-06 03:11:06 -06:00
* @return HasMany
2015-03-29 11:28:49 -05:00
*/
2016-02-06 03:11:06 -06:00
public function tags(): HasMany
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
/**
2016-02-06 03:11:06 -06:00
* @return HasMany
2015-02-11 00:35:10 -06:00
*/
2016-02-06 03:11:06 -06:00
public function transactionjournals(): HasMany
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-02-06 03:11:06 -06:00
* @return HasManyThrough
2015-02-11 00:35:10 -06:00
*/
2016-02-06 03:11:06 -06:00
public function transactions(): HasManyThrough
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
}