1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Models/User.php
2018-10-15 23:40:34 +11:00

66 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
use SoftDeletes;
protected $guard = 'user';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'first_name',
'last_name',
'email',
'password',
'phone',
'signature',
'avatar',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
'confirmation_code',
'oauth_user_id',
'oauth_provider_id',
'google_2fa_secret',
'google_2fa_phone',
'remember_2fa_token',
'slack_webhook_url',
];
public function user_accounts()
{
return $this->hasMany(UserAccount::class);
}
public function contacts()
{
return $this->hasMany(Contact::class);
}
public function owns($entity)
{
return ! empty($entity->user_id) && $entity->user_id == $this->id;
}
}