app/Http/Controllers/admin/CollectController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $data = $request->all();
        $req = $request -> has('gid','uid');
        if($req){
            $collect = new Collect;
            $collect -> gid = $data['gid'];
            $collect -> uid = $data['uid'];
            $res = $collect -> save();
            if($res){
                return redirect('admin/collect')->with('success','添加成功');
            }else{
                return back()->with('error','添加失败');
            }
        }else{
            return back()->with('error','请选择用户和需要收藏商品');
        }
    }
public function store ( Request $ request ) { $ data = $ request -> all ( ) ; $ req = $ request -> has ( 'gid' , 'uid' ) ; if ( $ req ) { $ collect = new Collect ; $ collect -> gid = $ data [ 'gid' ] ; $ collect -> uid = $ data [ 'uid' ] ; $ res = $ collect -> save ( ) ; if ( $ res ) { return redirect ( 'admin/collect' ) -> with ( 'success' , '添加成功'); } else { return back ( ) -> with ( 'error' , '添加失败'); } } else { return back ( ) -> with ( 'error' , '请选择用户和需要收藏商品'); } }
Store a newly created resource in storage.
Store a newly created resource in storage .