Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['bid_amount' => 'required|integer|min:10']);
     $bid = new Bid();
     $bid->bid_amount = $request->bid_amount;
     $bid->item()->associate(Item::find($request->item_id));
     $bid->bidder()->associate(Auth::user());
     $bid->save();
     return redirect()->route('bid.index');
 }
Пример #2
0
 /**
  * Search for items.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function search()
 {
     $query = Input::get('query');
     $itemSearch = Item::where('name', 'LIKE', '%$query%')->get();
     return response()->view('itemList', ['items' => $itemSearch]);
 }