mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 12:43:57 -06:00
141 lines
4.5 KiB
PHP
141 lines
4.5 KiB
PHP
<?php
|
|
|
|
use Illuminate\Auth\Reminders\RemindableInterface;
|
|
use Illuminate\Auth\Reminders\RemindableTrait;
|
|
use Illuminate\Auth\UserInterface;
|
|
use Illuminate\Auth\UserTrait;
|
|
use LaravelBook\Ardent\Ardent;
|
|
|
|
|
|
/**
|
|
* User
|
|
*
|
|
* @property integer $id
|
|
* @property \Carbon\Carbon $created_at
|
|
* @property \Carbon\Carbon $updated_at
|
|
* @property string $email
|
|
* @property string $password
|
|
* @property string $reset
|
|
* @property string $remember_token
|
|
* @property boolean $migrated
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Account[] $accounts
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Preference[] $preferences
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Budget[] $budgets
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Category[] $categories
|
|
* @method static \Illuminate\Database\Query\Builder|\User whereId($value)
|
|
* @method static \Illuminate\Database\Query\Builder|\User whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Query\Builder|\User whereUpdatedAt($value)
|
|
* @method static \Illuminate\Database\Query\Builder|\User whereEmail($value)
|
|
* @method static \Illuminate\Database\Query\Builder|\User wherePassword($value)
|
|
* @method static \Illuminate\Database\Query\Builder|\User whereReset($value)
|
|
* @method static \Illuminate\Database\Query\Builder|\User whereRememberToken($value)
|
|
* @method static \Illuminate\Database\Query\Builder|\User whereMigrated($value)
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Piggybank[] $piggybanks
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\RecurringTransaction[] $recurringtransactions
|
|
*/
|
|
class User extends Ardent implements UserInterface, RemindableInterface
|
|
{
|
|
|
|
use UserTrait, RemindableTrait;
|
|
|
|
|
|
public static $rules
|
|
= [
|
|
'email' => 'required|email|unique:users,email',
|
|
'migrated' => 'required|numeric|between:0,1',
|
|
'password' => 'required|between:60,60',
|
|
'reset' => 'between:32,32',
|
|
];
|
|
/**
|
|
* The database table used by the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'users';
|
|
/**
|
|
* The attributes excluded from the model's JSON form.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $hidden = ['remember_token'];
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public static function factory()
|
|
{
|
|
return [
|
|
'email' => 'email',
|
|
'password' => 'sander',
|
|
'migrated' => '0'
|
|
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function accounts()
|
|
{
|
|
return $this->hasMany('Account');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function budgets()
|
|
{
|
|
return $this->hasMany('Budget');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function categories()
|
|
{
|
|
return $this->hasMany('Category');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function components()
|
|
{
|
|
return $this->hasMany('Component');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function preferences()
|
|
{
|
|
return $this->hasMany('Preference');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function recurringtransactions()
|
|
{
|
|
return $this->hasMany('RecurringTransaction');
|
|
}
|
|
|
|
/**
|
|
* @param $value
|
|
*/
|
|
public function setPasswordAttribute($value)
|
|
{
|
|
$this->attributes['password'] = Hash::make($value);
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function transactionjournals()
|
|
{
|
|
return $this->hasMany('TransactionJournal');
|
|
}
|
|
|
|
} |