app/Http/Controllers/Admin/GoodsController.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()
    {
        $goods_name = request()->goods_name;
        $where = [];
        if($goods_name){
            $where[]=['goods_name','like',"%$goods_name%"];
        }
        $pagSize = config('app.pagSize');
        $goods = Goods::orderBy('goods_id','desc')->where($where)->paginate(3);
        return view('admin.goods.index',['goods'=>$goods,'goods_name'=>$goods_name,]);
    }
public function index ( ) { $ goods_name = request ( ) -> goods_name ; $ where = [ ] ; if ( $ goods_name ) { $ where [ ] = [ 'goods_name' , 'like' , " % $ goods_name % " ] ; } $ pagSize = config ( 'app.pagSize' ) ; $ goods = Goods :: orderBy ( 'goods_id' , 'desc' ) -> where ( $ where ) -> paginate ( 3 ) ; return view ( 'admin.goods.index' , [ 'goods' => $ goods , 'goods_name' => $ goods_name , ] ) ; }
Display a listing of the resource.
Display a listing of the resource .
//搜索 //dd($goods);