noganno
9/7/2017 - 5:32 AM

фильтр, несколько условий where

<?
$products = Product::where(function ( $q ) use ( $request ) {

				if ( $request->category ) {
					$q->where('category_id', $request->category);
				}

				if ( $request->status ) {
					$q->where('status', $request->status);
				}

				$q->where('type', $request->type);
			})->get();

			return $products;