update rm deadcode

This commit is contained in:
baodev0
2026-09-27 11:42:40 +07:00
parent 82a71244ca
commit 3af59bd9c5
129 changed files with 5194 additions and 2698 deletions
+11 -11
View File
@@ -6,7 +6,7 @@ use App\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
use App\Traits\HasUuid;
class Transaction extends Model
@@ -61,12 +61,6 @@ class Transaction extends Model
};
}
/**
* `proof_image` stores either a single relative storage path, or a
* JSON-encoded array of paths (admin-created service with multiple
* proofs). Resolve both shapes into absolute, browsable URLs so the
* raw path string never leaks into the frontend as a literal href.
*/
public function getProofImageUrlsAttribute(): array
{
if (! $this->proof_image) {
@@ -78,9 +72,15 @@ class Transaction extends Model
$paths = [$this->proof_image];
}
return array_values(array_map(
fn (string $path) => Storage::disk('public')->url($path),
array_filter($paths, fn ($path) => is_string($path) && $path !== '')
));
$paths = array_values(array_filter($paths, fn ($path) => is_string($path) && $path !== ''));
return array_map(
fn (int $index) => URL::temporarySignedRoute(
'admin.transactions.proof-image',
now()->addDay(),
['transaction' => $this->uuid, 'index' => $index],
),
array_keys($paths),
);
}
}