- Add new SVG icons for the "reply", "like", and "repost" actions - Update webmention info display in note template to include counts and icons for replies, likes, and reposts - Add webmention counts to FrontPageController.php and modify queries in NotesController.php - Modify WebMentionsTableSeeder.php to change URLs, commentable ID, and add new WebMentions
37 lines
1,019 B
PHP
37 lines
1,019 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Note;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
/**
|
|
* @psalm-suppress UnusedClass
|
|
*/
|
|
class SearchController extends Controller
|
|
{
|
|
public function search(Request $request): View
|
|
{
|
|
$search = $request->input('q');
|
|
|
|
$notes = Note::search($search)
|
|
->paginate();
|
|
|
|
/** @var Note $note */
|
|
foreach ($notes as $note) {
|
|
$note->load('place', 'media', 'client')
|
|
->loadCount(['webmentions AS replies' => function ($query) {
|
|
$query->where('type', 'in-reply-to');
|
|
}])
|
|
->loadCount(['webmentions AS likes' => function ($query) {
|
|
$query->where('type', 'like-of');
|
|
}])
|
|
->loadCount(['webmentions AS reposts' => function ($query) {
|
|
$query->where('type', 'repost-of');
|
|
}]);
|
|
}
|
|
|
|
return view('search', compact('search', 'notes'));
|
|
}
|
|
}
|