finished the upgrade to filament 4. completely revamped the frontend with codex, now it looks great!
This commit is contained in:
@@ -2,15 +2,16 @@
|
||||
|
||||
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 App\Settings\GeneralSettings;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function __construct(private GeneralSettings $settings) {}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$locale = app()->getLocale();
|
||||
@@ -18,12 +19,13 @@ class HomeController extends Controller
|
||||
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
|
||||
$galleryHeading = $this->settings->gallery_heading;
|
||||
$newImageTimespanMinutes = $this->settings->new_image_timespan_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;
|
||||
$image->path = 'storage/'.$image->path;
|
||||
|
||||
return $image;
|
||||
});
|
||||
|
||||
@@ -33,4 +35,4 @@ class HomeController extends Controller
|
||||
'images' => $images,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user