irankhosravi
2 months ago

How to dispaly alert after save a reports

Posted 2 months ago by irankhosravi

How to display alert after save a report. and redirect to profile?

public function store (ReportRequest $request)
{
    $report = Report::where('user_id',auth()->id())
        ->where( 'order_id', request('order_id'))
        ->exists();

    if ($report) {
        alert()->error('your order already saved.','ok')->persistent('close')->html();
        return redirect()->back();
    }

    $report = new Report($request->all());
    $report->user_id = auth()->user()->id;
    $report->date = $request->date;
    $report->time = $request->time;
    $report->order_id = $request->order_id;
    $report->status = 0;
    $report->code = $request->code;
    $report->save();
    
    alert()->success('your code is '.$request->issue_number.'.'."<br>".'the reports are saving..', 'ok')->persistent('close')->html();
    return redirect()->route('user.profile');
}

I want to after save redirect to profile of user. but alert did not displayed.

It must redirect()->back();.

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