invoiceninja/app/Models/User.php

66 lines
1.3 KiB
PHP
Raw Normal View History

2018-10-04 20:10:43 +03:00
<?php
namespace App\Models;
2018-10-04 20:10:43 +03:00
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
2018-10-04 20:10:43 +03:00
class User extends Authenticatable
{
use Notifiable;
use SoftDeletes;
2018-10-04 20:10:43 +03:00
protected $guard = 'user';
2018-10-04 20:10:43 +03:00
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'first_name',
'last_name',
'email',
'password',
'phone',
'signature',
'avatar',
2018-10-04 20:10:43 +03:00
];
/**
* 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',
2018-10-04 20:10:43 +03:00
];
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;
}
2018-10-04 20:10:43 +03:00
}