mardi 8 octobre 2019

Laraval, view show error when calling variable

 public function ordersajax(){
    // SOME CODE
    return view('orders.index')->renderSections()['content'].view('orders.index')->renderSections()['page_script'].view('orders.index')->renderSections()['page_css'];
    }

public function index()
{
    $id     =   Auth::user()->id;
    $totalOrders = Order::where('user_id', '<=', $id)->get();
    $totalOrders = $totalOrders->count();

    if(Auth::user()->role == 1)
    {
        return view('orders.index')->with('totalOrders',$totalOrders);
    }
    else if(Auth::user()->role == 0)
    {
        return back();
    }
    else if(Auth::user()->role == 2)
    {
        return back();
    }
    else {
        return view('/');
    }
}

`

and then calling the function

It works fine. But when I move from one page to another page and try to return back it throws an error and doesn't load. I am using ajax so it just shows the popup with an error. No specific error just says error.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire