<?php

use Livewire\Component;
use App\Models\Faq;

return new class extends Component
{
    public function render()
    {
        return $this->view()->layout('layouts::auth');
    }

    public function delete($id)
    {
        Faq::find($id)->delete();
        session()->flash('message', 'FAQ deleted successfully.');
    }

    public function updateOrder($id, $order)
    {
        Faq::find($id)->update(['sort_order' => $order]);
    }

    public function with()
    {
        return [
            'faqs' => Faq::orderBy('sort_order')->get(),
        ];
    }

    protected function view($data = [])
    {
        return app('view')->file('D:\02-my freelance\00-DR_Padhi\DR_PADHI\storage\framework/views/livewire/views/c2b80e91.blade.php', $data);
    }
};
