Example #1
0
 /**
  * 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);
 }
Example #2
0
 private function findProduct($id)
 {
     return Product::withDrafts()->findOrFail($id);
 }