firefly-iii/app/User.php
2016-01-01 21:49:27 +01:00

159 lines
4.8 KiB
PHP

<?php namespace FireflyIII;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Preference;
use FireflyIII\Models\Role;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Collection;
use Zizaco\Entrust\Traits\EntrustUserTrait;
/**
* Class User
*
* @package FireflyIII
* @property integer $id
* @property Carbon $created_at
* @property Carbon $updated_at
* @property string $email
* @property string $password
* @property string $reset
* @property string $remember_token
* @property-read Collection|Account[] $accounts
* @property-read Collection|Tag[] $tags
* @property-read Collection|Bill[] $bills
* @property-read Collection|Budget[] $budgets
* @property-read Collection|Category[] $categories
* @property-read Collection|Preference[] $preferences
* @property-read Collection|TransactionJournal[] $transactionjournals
* @property-read Collection|Role $roles
* @method static Builder|User whereId($value)
* @method static Builder|User whereCreatedAt($value)
* @method static Builder|User whereUpdatedAt($value)
* @method static Builder|User whereEmail($value)
* @method static Builder|User wherePassword($value)
* @method static Builder|User whereReset($value)
* @method static Builder|User whereRememberToken($value)
* @property boolean $blocked
* @property-read Collection|Attachment[] $attachments
* @method static Builder|User whereBlocked($value)
* @property string $blocked_code
* @method static Builder|User whereBlockedCode($value)
*/
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
use Authenticatable, CanResetPassword, EntrustUserTrait;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['email', 'password', 'blocked', 'blocked_code'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function accounts()
{
return $this->hasMany('FireflyIII\Models\Account');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function attachments()
{
return $this->hasMany('FireflyIII\Models\Attachment');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function tags()
{
return $this->hasMany('FireflyIII\Models\Tag');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function bills()
{
return $this->hasMany('FireflyIII\Models\Bill');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function budgets()
{
return $this->hasMany('FireflyIII\Models\Budget');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function categories()
{
return $this->hasMany('FireflyIII\Models\Category');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function piggyBanks()
{
return $this->hasManyThrough('FireflyIII\Models\PiggyBank', 'FireflyIII\Models\Account');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function transactions()
{
return $this->hasManyThrough('FireflyIII\Models\Transaction', 'FireflyIII\Models\TransactionJournal');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function preferences()
{
return $this->hasMany('FireflyIII\Models\Preference');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function transactionjournals()
{
return $this->hasMany('FireflyIII\Models\TransactionJournal');
}
}