1
0
Fork 0
forked from mirror/pixelfed
pixelfed/app/User.php

56 lines
1.2 KiB
PHP
Raw Normal View History

2018-04-15 17:56:48 -06:00
<?php
namespace App;
2018-08-31 18:38:07 -06:00
use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
2018-06-13 18:52:42 -06:00
use Illuminate\Database\Eloquent\SoftDeletes;
2018-04-15 17:56:48 -06:00
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
2018-08-31 18:38:07 -06:00
use Notifiable, SoftDeletes, HasApiTokens;
2018-06-13 18:52:42 -06:00
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
2018-09-15 23:15:45 -06:00
protected $dates = ['deleted_at', 'email_verified_at', '2fa_setup_at'];
2018-04-15 17:56:48 -06:00
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
2018-04-15 18:23:02 -06:00
'name', 'username', 'email', 'password',
2018-04-15 17:56:48 -06:00
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
2018-09-12 21:45:08 -06:00
'email', 'password', 'is_admin', 'remember_token',
'email_verified_at', '2fa_enabled', '2fa_secret',
'2fa_backup_codes', '2fa_setup_at',
2018-04-15 17:56:48 -06:00
];
public function profile()
{
return $this->hasOne(Profile::class);
}
2018-04-18 23:57:31 -06:00
public function url()
{
2018-08-28 03:07:36 +00:00
return url(config('app.url').'/'.$this->username);
2018-04-18 23:57:31 -06:00
}
2018-07-23 18:52:29 -06:00
public function settings()
{
return $this->hasOne(UserSetting::class);
}
2018-04-15 17:56:48 -06:00
}