You've already forked Atomcms-edit
Initial commit
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Miscellaneous;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Articles\WebsiteArticle;
|
||||
use App\Models\Miscellaneous\CameraWeb;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function __invoke(): View
|
||||
{
|
||||
$articles = Cache::remember('home_articles', 300, fn () => WebsiteArticle::with(['user:id,username,look'])
|
||||
->latest('id')
|
||||
->take(4)
|
||||
->get());
|
||||
|
||||
$photos = Cache::remember('home_photos', 300, fn () => CameraWeb::query()
|
||||
->where('visible', true)
|
||||
->latest('id')
|
||||
->take(4)
|
||||
->with('user:id,username,look')
|
||||
->get());
|
||||
|
||||
return view('index', [
|
||||
'articles' => $articles,
|
||||
'photos' => $photos,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user