34 lines
728 B
PHP
34 lines
728 B
PHP
<?php
|
|
|
|
namespace App\Services\Report;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
final class StampService
|
|
{
|
|
private User $user;
|
|
|
|
public function __construct(User|int|null $user = null)
|
|
{
|
|
$this->user = me($user);
|
|
}
|
|
|
|
public function hasSignatureImage(): bool
|
|
{
|
|
$path = $this->user->signature_image_path;
|
|
|
|
return $path !== null && Storage::disk('public')->exists($path);
|
|
}
|
|
|
|
public function signatureImagePath(): string
|
|
{
|
|
return Storage::disk('public')->path($this->user->signature_image_path);
|
|
}
|
|
|
|
public function signatureImageUrl(): string
|
|
{
|
|
return Storage::disk('public')->url($this->user->signature_image_path);
|
|
}
|
|
}
|