503f38ee06
* add new currency table and make debt currency agnostic * removed currencytableseeder from production run job * russian ruble added to currencies * fix up default value * fix down migration and remove seed
85 lines
1.6 KiB
PHP
85 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
use Notifiable;
|
|
use SoftDeletes;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name', 'email', 'password',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be hidden for arrays.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $hidden = [
|
|
'password', 'remember_token',
|
|
];
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
/**
|
|
* Get the account record associated with the user.
|
|
*/
|
|
public function account()
|
|
{
|
|
return $this->hasOne('App\Account');
|
|
}
|
|
|
|
/**
|
|
* Indicates if the layout is fluid or not for the UI.
|
|
* @return string
|
|
*/
|
|
public function getFluidLayout()
|
|
{
|
|
if ($this->fluid_container == 'true') {
|
|
return 'container-fluid';
|
|
} else {
|
|
return 'container';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getMetricSymbol()
|
|
{
|
|
if ($this->metric == 'fahrenheit') {
|
|
return 'F';
|
|
} else {
|
|
return 'C';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets the currency for this user.
|
|
*/
|
|
public function currency()
|
|
{
|
|
return $this->belongsTo('App\Currency', 'currency_id');
|
|
}
|
|
/**
|
|
* Set the contact view preference.
|
|
*
|
|
* @param string $preference
|
|
*/
|
|
public function updateContactViewPreference($preference)
|
|
{
|
|
$this->contacts_sort_order = $preference;
|
|
$this->save();
|
|
}
|
|
}
|