irankhosravi
2 months ago
157
12
Laravel

How to dispay sweet alert ?

Posted 2 months ago by irankhosravi

I want to make a condition to show if there is anyone in the database. Show sweet alert if not available

My Controller.php

public function document(Request $request)
{
    $keyword = $request->input('code');
    $documents = Document::document($keyword)->latest()->get();
    if (!isset($documents)) {
        alert()->error('Information with this number has not been disclosed to the system.', 'ok')->persistent('ok');
    }
    return view('Home.content.documents', compact('documents'));
}

Please sign in or create an account to participate in this conversation.