Packaged version of the recreate gallery project
PHP 8.1 and up
Laravel 9 and up
composer require lisa-fehr/gallery
php artisan storage:link
php artisan gallery:install
php artisan images:generate
npm run development
php artisan db:seed
<link rel="stylesheet" href="{{ asset('vendor/lisa-fehr/gallery/css/app.css') }}" type="text/css" media="screen"/>
...
<script src="{{mix('js/app.js', 'vendor/lisa-fehr/gallery')}}"></script>
<div id="gallery-app" class="text-sm w-full" data-filters="{{$filter['tags'] ?? ''}}"></div>
You can also override routes with inconsistent patterns:
{
"tag": "path from root - no starting slash needed"
}
<div id="gallery-app" class="text-sm w-full"
data-filters="{{$filter['tags'] ?? ''}}"
data-routes='{"portfolio":"portfolio","Folder2005":"Folder\/2005"}'
></div>
Add this kind of code to routes, where tags
match the uber_tags
table (route name
is required to match the tag):
Route::get('photos', function () {
return view('portfolio')->with('filter', ['tags' => 'California,California2005,California2009,California2014']);
})->name('photos');
Or use the Tag model to get all the children:
Route::get('California', function () {
$children = UberTags::where('name', 'california')->allChildren()->pluck('name')->implode(',');
return view('portfolio')->with('filter', ['tags' => 'california,' . $children]);
})->name('California');
If the named route for the tag doesn't exist, it will not show up in navigation to prevent broken links.