9 months ago

How to dispaly alert after save a reports

Posted 9 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'))

    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;
    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.