So I am creating a medical app for a school project. I am fairly new to Laravel and even though I've learnt some things so far in it, I am stuck with creating a Search engine for users to search by disease name and symptom. I used Voyager for my admin panel and Jetstream for scaffolding. Livewire is also present. I have a database table called Diagnoses with columns such as name, description, types, symptoms, causes, treatments, advice. After a user logs in and reaches the dashboard (dashboard.blade.php) I want there to be a Search form where they can search for by name and symptom then display the results like a typical search should do.
Table that I want the results from
Table name = Diagnoses, Model = Diagnose, Controller = DiagnoseController.php
How can I accomplish this? Here are the codes that I think I should be working with:
web.php:
Route::get('/', function () {
return view('main');
});
Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
Route::group(['prefix' => 'admin'], function () {
Voyager::routes();
});
Route::get("/about", function () {
return view('about');
});
Route::get("/contact", function () {
return view('contact');
});
Model Diagnose.php:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Diagnose extends Model
{
use HasFactory;
}
Controller DiagnoseController.php:
<?PHP
namespace App\Http\Controllers;
use App\Model\
use Illuminate\Http\Request;
class DiagnoseController extends Controller
{
//
}
Views dashboard.blade.php:
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Dashboard') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
*Put code here*
</div>
</div>
</div>
</x-app-layout>
Yes, I am a novice so that's why I am seeking help. Also if there is a better way or easier way then please show me. Thanks in advance.