public function index() { $search = Input::get('q'); $items = $search ? History::where('message', 'LIKE', '%' . $search . '%')->orWhere('username', 'LIKE', '%' . $search . '%')->orderBy('created_at', 'DESC')->get() : History::orderBy('created_at', 'DESC')->get(); return view('History.index')->with(['title' => $this->title, 'items' => $items, 'search' => $search]); }
public function show($id) { $item = Items::with('recipes')->with('purchases')->findOrFail($id); $history = History::where('message', 'LIKE', '%(ID ' . $id . ')%')->where('action', '=', 'App\\Http\\Controllers\\StockCheckController@store ')->get(); echo '<pre>'; echo $history->count(); echo 'id: ' . $id; echo '</pre>'; return view('Items.show')->with(array('title' => $this->title, 'item' => $item, 'history' => $history)); }