app/Http/Controllers/admin/GoodImagesController.php
/**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
Show the form for creating a new resource.
@return \Illuminate\Http\Response
Show the form for creating a new resource . @return \ Illuminate \ Http \ Response
public function create(Request $request)
    {
        if($request ->ajax()){
            $gcid = $request->input('gcid','');
            $goods = Goods::where('gcid',$gcid)->get();
            echo  json_encode($goods);
            return;
        }
        return view('admin.goodimages.create',['title'=>'详图添加','cates'=>self::getcates()]);
    }
public function create ( Request $ request ) { if ( $ request -> ajax ( ) ) { $ gcid = $ request -> input ( 'gcid' , '' ) ; $ goods = Goods :: where ( 'gcid' , $ gcid ) -> get ( ) ; echo json_encode ( $ goods ) ; return ; } return view ( 'admin.goodimages.create' , [ 'title' => '详图添加','cates' = >self:: ge tcat es ()]); }
Show the form for creating a new resource.
Show the form for creating a new resource .
//判断是否是ajax发送过来的请求 // dump($gcid); // dump();