Files
monica/app/User.php
T
Paul Anthony 503f38ee06 Add new currency table and make debt currency agnostic (#188)
* 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
2017-06-10 21:34:15 -04:00

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();
}
}