language files combined, settings fixed, "new" badge integrated

This commit is contained in:
2025-08-01 23:34:41 +02:00
parent b2968f203d
commit 80873877c1
44 changed files with 1319 additions and 358 deletions

View File

@@ -4,20 +4,33 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Setting;
use App\Models\Image;
use Inertia\Inertia;
use Illuminate\Support\Facades\Lang;
use Carbon\Carbon;
class HomeController extends Controller
{
public function index()
{
$locale = app()->getLocale();
$translations = Lang::get('messages', [], $locale);
$translations = array_merge(
Lang::get('api', [], $locale),
Lang::get('settings', [], $locale)
);
$galleryHeading = Setting::where('key', 'gallery_heading')->first()->value ?? 'Style Gallery';
$newImageTimespanMinutes = Setting::where('key', 'new_image_timespan_minutes')->first()->value ?? 60; // Default to 60 minutes
$images = Image::all()->map(function ($image) use ($newImageTimespanMinutes) {
$image->is_new = Carbon::parse($image->created_at)->diffInMinutes(Carbon::now()) <= $newImageTimespanMinutes;
$image->path = 'storage/' . $image->path;
return $image;
});
return Inertia::render('Home', [
'translations' => $translations,
'galleryHeading' => $galleryHeading,
'images' => $images,
]);
}
}