Пример #1
0
 public function delBid($id)
 {
     try {
         $bid = Bid::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         return Redirect::to('/')->withInput()->withErrors('竞价信息不存在或已被删除!');
     }
     $bid->delete();
     return Redirect::back()->withInput()->withErrors('删除成功!');
 }
Пример #2
0
 public function win(Request $request)
 {
     try {
         $action = $request->get("action");
         if ($action == "") {
             $bid = Bid::findOrFail($request->get('id'));
             if ($bid->demand->stauts < 0) {
                 return Redirect::to('/demand/show/' . $bid->demand->id)->withErrors('当前状态下不能选择中标!');
             }
             if (Auth::user()->id != $bid->demand->user_id) {
                 return '没有权限';
                 return Redirect::to('/demand/show/' . $bid->demand->id)->withInput()->withErrors('没有权限!');
             }
             $bid->is_win = 1;
             $bid->demand->status = 1;
             $bid->save();
             $bid->demand->save();
             return '操作成功';
             return Redirect::to('/demand/show/' . $bid->demand->id)->withInput()->withErrors('操作成功!');
         }
         if ($action == "drop") {
             $deid = $request->get("deid");
             $demand = Demand::findOrFail($deid);
             $demand->status = "-3";
             //取消,放弃
             $demand->deposit = 0;
             //扣除保证金
             $demand->save();
             return '操作成功';
         }
     } catch (ModelNotFoundException $e) {
         return '删除';
         return Redirect::to('/')->withInput()->withErrors('竞购信息不存在或已被删除!');
     }
 }