Files
streamline-emr/docker/streamline-src/app/Models/User.php
T
alec.turner a424394109 Build modified streamline images
The official image from streamline does not currently work for the arm64
platform. As a temporary measure, the source code and docker build scripts
have been lifted from the official images and are used to build locally.

Some additional modifications are made to reduce overall image size, these
are documented in docker/README.md
2024-03-10 16:17:50 -07:00

90 lines
2.5 KiB
PHP
Executable File

<?php
namespace Streamline\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;
use OwenIt\Auditing\Contracts\Auditable;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\SoftDeletes;
//use Laravel\Passport\HasApiTokens;
class User extends Authenticatable implements Auditable {
// use HasApiTokens;
use Notifiable;
use HasRoles;
/*
* use laravel-auditing to track database changes
*/
use \OwenIt\Auditing\Auditable;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'first_name', 'last_name', 'username', 'phone', 'position_id', 'email', 'photo', 'council_registration', 'willing_to_donate', 'last_donation_date', 'council_id', 'registration_number', 'expiry_date', 'password',
'pin', 'blood_group_id', 'created_by', 'updated_by', 'last_seen'
];
public $timestamps = true;
protected $rememberTokenName = false;
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token'
];
protected $casts = [
'expiry_date' => 'datetime',
'last_donation_date' => 'datetime'
];
/*
* Below are some mutators
*/
public function setExpiryDateAttribute($expiry_date) {
$this->attributes['expiry_date'] = empty($expiry_date) ? NULL : Carbon::createFromFormat('d/m/Y', $expiry_date)->format('Y-m-d');
}
public function setLastDonationDateAttribute($last_donation_date) {
$this->attributes['last_donation_date'] = empty($last_donation_date) ? NULL : Carbon::createFromFormat('d/m/Y', $last_donation_date)->format('Y-m-d');
}
/*
* Accessors
*/
public function getExpiryDateAttribute($expiry_date) {
$slash_date = $expiry_date == NULL ? '' : Carbon::createFromFormat('Y-m-d', $expiry_date)->format('d/m/Y');
return $slash_date;
}
public function getLastDonationDateAttribute($last_donation_date) {
$slash_date = '';//$last_donation_date == NULL ? '' : Carbon::createFromFormat('Y-m-d', $last_donation_date)->format('d/m/Y');
return $slash_date;
}
/*
* Other methods
*/
public static function resolveId() {
return Auth::check() ? Auth::user()->getAuthIdentifier() : null;
}
public function passwordSecurity()
{
return $this->hasOne('Streamline\Models\PasswordSecurity');
}
}