Created
February 7, 2018 02:03
-
-
Save robertnicjoo/4f78bec892abd74eeb2a83e532407faa to your computer and use it in GitHub Desktop.
finder function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$post = $request->all(); //Initialize the request | |
$test = DB::table('products') | |
->where('subcategory_id','=',$post['subcategory_id']); | |
if(isset($post['specification_id']) && !(isset($post['brand_id']))) | |
{ | |
$query = $query->where('subspecification_id','=',$post['specification_id']); | |
} | |
elseif(!(isset($post['specification_id'])) && isset($post['brand_id'])) | |
{ | |
$query = $query->where('brand_id','=',$post['brand_id']); | |
} | |
else | |
{ | |
$query = $query->where('subspecification_id','=',$post['specification_id']) | |
->where('brand_id','=',$post['brand_id']); | |
} | |
$test = $test->get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment