Re-add search functionality
This commit is contained in:
parent
92c0a517c2
commit
58c5a7d443
11 changed files with 297 additions and 19 deletions
25
app/Http/Controllers/SearchController.php
Normal file
25
app/Http/Controllers/SearchController.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Note;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
return view('search', compact('search', 'notes'));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue