update rm deadcode
This commit is contained in:
+11
-11
@@ -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),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user