Work so far in refactoring front-end
- Mainly getting rid of existing css/js - No longer linking to stuff like a11y.css - Creating a FrontPageController to better deal with the home page
This commit is contained in:
parent
30f9b0f557
commit
5ef23376be
135 changed files with 7461 additions and 100 deletions
44
app/Http/Controllers/FrontPageController.php
Normal file
44
app/Http/Controllers/FrontPageController.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Exception;
|
||||
use App\Models\Like;
|
||||
use App\Models\Note;
|
||||
use App\Models\Article;
|
||||
use App\Models\Bookmark;
|
||||
|
||||
class FrontPageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show all the recent activity.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$pageNumber = request()->query('page') ?? 1;
|
||||
|
||||
$notes = Note::latest()->get();
|
||||
$articles = Article::latest()->get();
|
||||
$bookmarks = Bookmark::latest()->get();
|
||||
$likes = Like::latest()->get();
|
||||
|
||||
$allItems = collect($notes)
|
||||
->merge($articles)
|
||||
->merge($bookmarks)
|
||||
->merge($likes)
|
||||
->sortByDesc('updated_at')
|
||||
->chunk(10);
|
||||
|
||||
$totalNumPages = $allItems->count();
|
||||
|
||||
$page = $allItems->get($pageNumber - 1);
|
||||
|
||||
if (is_null($page)) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return view('front-page', [
|
||||
'items' => $page,
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue