<?php namespace Illuminate\Http; use Illuminate\Support\Str; trait FileHelpers { /** * The cache copy of the file's hash name. * * @var string */ protected $hashName = null; /** * Get the fully qualified path to the file. * * @return string */ public function path() { return $this->getRealPath(); } /** * Get the file's extension. * * @return string */ public function extension() { return $this->guessExtension(); } /** * Get a filename for the file. * * @param string|null $path * @return string */ public function hashName($path = null) { if ($path) { $path = rtrim($path, '/').'/'; } $hash = $this->hashName ?: $this->hashName = Str::random(40); if ($extension = $this->guessExtension()) { $extension = '.'.$extension; } return $path.$hash.$extension; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
.github | Folder | 0755 |
|
|
Client | Folder | 0755 |
|
|
Concerns | Folder | 0755 |
|
|
Exceptions | Folder | 0755 |
|
|
Middleware | Folder | 0755 |
|
|
Resources | Folder | 0755 |
|
|
Testing | Folder | 0755 |
|
|
.gitattributes | File | 54 B | 0644 |
|
File.php | File | 165 B | 0644 |
|
FileHelpers.php | File | 1.03 KB | 0644 |
|
JsonResponse.php | File | 3.58 KB | 0644 |
|
LICENSE.md | File | 1.07 KB | 0644 |
|
RedirectResponse.php | File | 6.07 KB | 0644 |
|
Request.php | File | 18.49 KB | 0644 |
|
Response.php | File | 3.13 KB | 0644 |
|
ResponseTrait.php | File | 3.93 KB | 0644 |
|
UploadedFile.php | File | 4.16 KB | 0644 |
|
composer.json | File | 1.31 KB | 0644 |
|