This commit is contained in:
Dr Masroor Ehsan 2025-01-04 18:08:48 +06:00
parent 1b3de1aacb
commit 1878b0e494
3 changed files with 22 additions and 2 deletions

View File

@ -6,7 +6,6 @@
use App\Models\Study;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
@ -34,7 +33,7 @@ public function dataTable(QueryBuilder $query): EloquentDataTable
return '';
}
return '<img class="rounded-circle me-4" height="24px" width="24px" src="'.Storage::url($study->readingPhysician->profile_photo_path).'"></img>'.$study->readingPhysician->display_name;
return '<img class="rounded-circle me-4" height="24px" width="24px" src="'.$study->readingPhysician->avatar().'"></img>'.$study->readingPhysician->display_name;
})
->editColumn('images', function (Study $study) {
return $study->numInstances().'<br /><small class="text-muted mt-2">'.human_filesize($study->disk_size).'</small>';

View File

@ -12,9 +12,11 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Storage;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;
use Laravolt\Avatar\Avatar;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable
@ -115,4 +117,22 @@ public function getLastSeenAttribute(): Carbon
{
return $this->lastSeen();
}
public function getFullNameAttribute(): string
{
return trim($this->first_name.' '.$this->last_name);
}
public function avatar(): string
{
if (filled($this->profile_photo_path)) {
return Storage::url($this->profile_photo_path);
}
if (filled($this->email)) {
return (new Avatar)->create($this->email)->toGravatar();
}
return (new Avatar)->create($this->full_name)->toBase64();
}
}

View File

@ -16,6 +16,7 @@
"laravel/sanctum": "^4.0",
"laravel/socialite": "^5.16",
"laravel/tinker": "^2.9",
"laravolt/avatar": "^6.0",
"livewire/livewire": "^3.0",
"phpoffice/phpword": "^1.3",
"propaganistas/laravel-phone": "^5.3",