<?php

namespace App\Http\Controllers\admin;

use App\Http\Controllers\Controller;
use App\Models\Patient;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;

class PatientController extends Controller
{
    public function index()
    {
        $patients = Patient::all();
        return  view('admin.patients.index', ['patients' => $patients]);
    }

    public function delete($id,Request $request)
    {
        Patient::where('id',$id)->delete();
        $request->session()->flash('message', 'Patient deleted successfully');
        return redirect()->back();
    }
}