/** * Get the query object to be processed by datatables. * * @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder */ public function query() { $products = Product::withDrafts()->with(['categories'])->select('products.*')->latest('id'); return $this->applyScopes($products); }
private function findProduct($id) { return Product::withDrafts()->findOrFail($id); }