52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Dashboard;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Artwork;
|
|
use App\Models\ContentType;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class DashboardGalleryController extends Controller
|
|
{
|
|
public function index(Request $request): View
|
|
{
|
|
$user = $request->user();
|
|
$perPage = 24;
|
|
|
|
$query = Artwork::query()
|
|
->where('user_id', (int) $user->id)
|
|
->orderBy('published_at', 'desc');
|
|
|
|
$artworks = $query->paginate($perPage)->withQueryString();
|
|
|
|
$mainCategories = ContentType::orderBy('id')
|
|
->get(['name', 'slug'])
|
|
->map(function (ContentType $type) {
|
|
return (object) [
|
|
'id' => $type->id,
|
|
'name' => $type->name,
|
|
'slug' => $type->slug,
|
|
'url' => '/' . strtolower($type->slug),
|
|
];
|
|
});
|
|
|
|
return view('gallery.index', [
|
|
'gallery_type' => 'dashboard',
|
|
'mainCategories' => $mainCategories,
|
|
'subcategories' => $mainCategories,
|
|
'contentType' => null,
|
|
'category' => null,
|
|
'artworks' => $artworks,
|
|
'hero_title' => 'My Gallery',
|
|
'hero_description' => 'Your uploaded artworks.',
|
|
'breadcrumbs' => collect(),
|
|
'page_title' => 'My Gallery - SkinBase',
|
|
'page_meta_description' => 'My uploaded artworks on SkinBase',
|
|
'page_meta_keywords' => 'my gallery, uploads, skinbase',
|
|
'page_canonical' => url('/dashboard/gallery'),
|
|
]);
|
|
}
|
|
}
|