lisa-fehr / gallery
Gallery package for existing site
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^8.1
- ext-json: *
- intervention/image: ^2.7.2
- spatie/laravel-query-builder: ^5.3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.23.0
This package is auto-updated.
Last update: 2024-05-19 07:43:56 UTC
README
Packaged version of the recreate gallery project
Run:
composer require lisa-fehr/gallery
php artisan storage:link
php artisan gallery:install
php artisan images:generate
npm run development
Add the css and js files to your layout file:
<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>
Add this div to a view called portfolio
:
<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 to routes file
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.