Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/OswalSnow/AR-Barber/llms.txt

Use this file to discover all available pages before exploring further.

The PortfolioImage model tracks uploaded photos of barber work. Each record holds a relative file path on the public storage disk. Images are displayed in reverse-chronological order in the Nuevos Cortes tab on the public homepage. Deletion removes both the database record and the physical file from storage.

Fields

id
integer
required
Auto-incrementing primary key.
path
string
required
Relative path to the image file on the public storage disk. The path is stored without a leading slash and follows the pattern portfolio/filename.jpg. To build a publicly accessible URL, pass the path to asset() with the storage/ prefix:
asset('storage/' . $image->path)
// e.g. https://yourapp.com/storage/portfolio/abc123.jpg
created_at
datetime
Timestamp set automatically when the record is created. Used as the sort key when retrieving images for display.
updated_at
datetime
Timestamp updated automatically on every save.

Retrieving images for display

Images are fetched in reverse-chronological order (newest first) for the portfolio gallery:
$images = PortfolioImage::latest()->get();
In a Blade template, render the full URL using asset():
<img src="{{ asset('storage/' . $image->path) }}" alt="Portfolio photo">

Uploading images

When a new photo is uploaded, store the file on the public disk under the portfolio/ directory and record the returned path:
$path = $request->file('image')->store('portfolio', 'public');

PortfolioImage::create(['path' => $path]);

Deleting images

Deleting a PortfolioImage record must also remove the physical file from disk. The application handles this explicitly using Storage::disk('public')->delete():
Storage::disk('public')->delete($image->path);
$image->delete();
Calling $image->delete() alone only removes the database record. The file on disk remains and will accumulate as orphaned storage. Always pair the two operations when removing a portfolio image.
The public disk serves files from storage/app/public/. For these files to be accessible via a browser URL, a symbolic link must exist at public/storage pointing to that directory. Run this once after deploying or cloning the project:
php artisan storage:link
Without this link, asset('storage/...') URLs will return 404 responses even though the files exist on disk.
On shared hosting or some deployment platforms the symlink may need to be created manually, or the FILESYSTEM_DISK environment variable set to a driver that serves files differently (for example, S3). Check your .env configuration if images are not loading after running storage:link.

Build docs developers (and LLMs) love