File: /var/www/vhost/disk-apps/dev-telemedicina.teky.com.co/app/User.php
<?php
namespace Telemedicina;
use Telemedicina\Rol;
use Telemedicina\Module;
use Telemedicina\MedicalCenter;
use Laravel\Passport\HasApiTokens;
use Telemedicina\Traits\Encryptable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Auth\Notifications\ResetPassword;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use HasApiTokens, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be encrypt.
*
* @var array
*/
// protected $encryptable = [
// 'name',
// 'last_name',
// // 'phone',
// // 'emergency_contact_name',
// // 'emergency_contact_phone',
// // 'dob',
// // 'address'
// ];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function findForPassport($document)
{
return $this->where('document', $document)->first();
}
public function rol(){
return $this->belongsTo(Rol::class)->select(array('id','name'));
}
public function terms(){
return $this->hasMany(UserTerm::class);
}
public function user_terms()
{
return $this->hasMany(UserTerm::class);
}
public function modules(){
return $this->belongsTo(Module::class)->select(array('id','name'));
}
public function centro(){
return $this->belongsTo(MedicalCenter::class, 'center_id', 'id');
}
public function identification_type(){
return $this->belongsTo(IdentificationType::class, 'identification_type_id');
}
public function city(){
return $this->belongsTo(City::class)->with('department');
}
public function insurance(){
return $this->belongsTo(Insurance::class);
}
public function specialty(){
return $this->belongsTo(Specialty::class);
}
/**
* Sends the password reset notification.
*
* @param string $token
*
* @return void
*/
public function sendPasswordResetNotification($token)
{
$this->notify(new CustomPassword($token));
}
}
class CustomPassword extends ResetPassword
{
public function toMail($notifiable)
{
return (new MailMessage)
->from(config('mail.from.address'))
->subject(__('messages.password_reset.subject'))
->greeting(__('messages.password_reset.greeting'))
->line(__('messages.password_reset.line1'))
->action(__('messages.password_reset.password_reset'), url(config('app.url') . route('password.reset', $this->token, false)))
->line(__('messages.password_reset.line2'));
}
}