app/Http/Controllers/OrderController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Request $request)
    {
        $orders = Order::latest()->paginate(10);
        if($request->has('search')){
            $orders = Order::where('fullname','like',"%{$request->get('search')}%")->orWhere('email','like',"%{$request->get('search')}%")->orderBy('id' , 'desc')->paginate(10);
        }
        return view('admin.order.index', [
            'data' => $orders
        ]);
    }
public function index ( Request $ request ) { $ orders = Order :: latest ( ) -> paginate ( 10 ) ; if ( $ request -> has ( 'search' ) ) { $ orders = Order :: where ( 'fullname' , 'like' , " % { $ request -> get ( 'search' ) } % " ) -> orWhere ( 'email' , 'like' , " % { $ request -> get ( 'search' ) } % " ) -> orderBy ( 'id' , 'desc' ) -> paginate ( 10 ) ; } return view ( 'admin.order.index' , [ 'data' => $ orders ] ) ; }
Display a listing of the resource.
Display a listing of the resource .
// Lay toan bo don hang, sap sep mới -> cũ