Laravel variable to where clause












0















I am trying to extend one app to use my new Laravel app. In this scenario I am getting an unknown number of filters and I would like to forward them all to where() clause.



I have made something like this:



private function filterConverter($filter)
{
$f = ;
foreach ($filter as $singleFilter) {
$operator = $this->filterValues[$singleFilter['operator']];
$value = $operator == 'like' ? '%' . $singleFilter['value'] . '%' : $singleFilter['value'];

$f = $singleFilter['field'] . ',' . $operator . ',' . $value;
}

return $f;
}


The thing is that I am getting operators like EQUALS and CONTAINS so I need to convert them to = and LIKE.



With this code I am trying to do this:



return response(MyModel::where($filter)->get());


But it doesn't work. Is there any elegant way to resolve this?



EDIT/SOLUTION



Sorry to @HCK as I couldn't quite accept the answer since it doesn't answer my question, but it pointed me on the right track. The solution was to use key, operator, value keys in the array instead of what I had "keyless".



private function filterConverter($filters)
{
$filter = ;
foreach ($filters as $singleFilter) {
$operator = $this->filterMap[$singleFilter['operator']];
$value = $operator == 'LIKE' ? '%' . $singleFilter['value'] . '%' : $singleFilter['value'];

$filter = [
'key' => $singleFilter['field'],
'operator' => $operator,
'value' => $value
];
}

return $filter;
}









share|improve this question

























  • It might be worth having a look at github.com/Kyslik/laravel-filterable

    – Ross Wilson
    Nov 25 '18 at 20:47
















0















I am trying to extend one app to use my new Laravel app. In this scenario I am getting an unknown number of filters and I would like to forward them all to where() clause.



I have made something like this:



private function filterConverter($filter)
{
$f = ;
foreach ($filter as $singleFilter) {
$operator = $this->filterValues[$singleFilter['operator']];
$value = $operator == 'like' ? '%' . $singleFilter['value'] . '%' : $singleFilter['value'];

$f = $singleFilter['field'] . ',' . $operator . ',' . $value;
}

return $f;
}


The thing is that I am getting operators like EQUALS and CONTAINS so I need to convert them to = and LIKE.



With this code I am trying to do this:



return response(MyModel::where($filter)->get());


But it doesn't work. Is there any elegant way to resolve this?



EDIT/SOLUTION



Sorry to @HCK as I couldn't quite accept the answer since it doesn't answer my question, but it pointed me on the right track. The solution was to use key, operator, value keys in the array instead of what I had "keyless".



private function filterConverter($filters)
{
$filter = ;
foreach ($filters as $singleFilter) {
$operator = $this->filterMap[$singleFilter['operator']];
$value = $operator == 'LIKE' ? '%' . $singleFilter['value'] . '%' : $singleFilter['value'];

$filter = [
'key' => $singleFilter['field'],
'operator' => $operator,
'value' => $value
];
}

return $filter;
}









share|improve this question

























  • It might be worth having a look at github.com/Kyslik/laravel-filterable

    – Ross Wilson
    Nov 25 '18 at 20:47














0












0








0








I am trying to extend one app to use my new Laravel app. In this scenario I am getting an unknown number of filters and I would like to forward them all to where() clause.



I have made something like this:



private function filterConverter($filter)
{
$f = ;
foreach ($filter as $singleFilter) {
$operator = $this->filterValues[$singleFilter['operator']];
$value = $operator == 'like' ? '%' . $singleFilter['value'] . '%' : $singleFilter['value'];

$f = $singleFilter['field'] . ',' . $operator . ',' . $value;
}

return $f;
}


The thing is that I am getting operators like EQUALS and CONTAINS so I need to convert them to = and LIKE.



With this code I am trying to do this:



return response(MyModel::where($filter)->get());


But it doesn't work. Is there any elegant way to resolve this?



EDIT/SOLUTION



Sorry to @HCK as I couldn't quite accept the answer since it doesn't answer my question, but it pointed me on the right track. The solution was to use key, operator, value keys in the array instead of what I had "keyless".



private function filterConverter($filters)
{
$filter = ;
foreach ($filters as $singleFilter) {
$operator = $this->filterMap[$singleFilter['operator']];
$value = $operator == 'LIKE' ? '%' . $singleFilter['value'] . '%' : $singleFilter['value'];

$filter = [
'key' => $singleFilter['field'],
'operator' => $operator,
'value' => $value
];
}

return $filter;
}









share|improve this question
















I am trying to extend one app to use my new Laravel app. In this scenario I am getting an unknown number of filters and I would like to forward them all to where() clause.



I have made something like this:



private function filterConverter($filter)
{
$f = ;
foreach ($filter as $singleFilter) {
$operator = $this->filterValues[$singleFilter['operator']];
$value = $operator == 'like' ? '%' . $singleFilter['value'] . '%' : $singleFilter['value'];

$f = $singleFilter['field'] . ',' . $operator . ',' . $value;
}

return $f;
}


The thing is that I am getting operators like EQUALS and CONTAINS so I need to convert them to = and LIKE.



With this code I am trying to do this:



return response(MyModel::where($filter)->get());


But it doesn't work. Is there any elegant way to resolve this?



EDIT/SOLUTION



Sorry to @HCK as I couldn't quite accept the answer since it doesn't answer my question, but it pointed me on the right track. The solution was to use key, operator, value keys in the array instead of what I had "keyless".



private function filterConverter($filters)
{
$filter = ;
foreach ($filters as $singleFilter) {
$operator = $this->filterMap[$singleFilter['operator']];
$value = $operator == 'LIKE' ? '%' . $singleFilter['value'] . '%' : $singleFilter['value'];

$filter = [
'key' => $singleFilter['field'],
'operator' => $operator,
'value' => $value
];
}

return $filter;
}






php laravel laravel-5






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 7:58







Norgul

















asked Nov 25 '18 at 19:57









NorgulNorgul

1,64011745




1,64011745













  • It might be worth having a look at github.com/Kyslik/laravel-filterable

    – Ross Wilson
    Nov 25 '18 at 20:47



















  • It might be worth having a look at github.com/Kyslik/laravel-filterable

    – Ross Wilson
    Nov 25 '18 at 20:47

















It might be worth having a look at github.com/Kyslik/laravel-filterable

– Ross Wilson
Nov 25 '18 at 20:47





It might be worth having a look at github.com/Kyslik/laravel-filterable

– Ross Wilson
Nov 25 '18 at 20:47












2 Answers
2






active

oldest

votes


















0
















Not the nicest way to solve it, but this should work:



private function filterConverter($filters)
{
return collect($filters)->map(function ($filter) { // <---
if($filter['operator'] == 'CONTAINS')
{
$filter['value'] = '%' . $filter['value'] . '%';
$filter['operator'] = 'LIKE';
}
else if ($filter['operator'] == 'EQUALS')
{
$filter['operator'] = '=';
}

return collect($filter)->flatten(); // <---
})->toArray(); // <---
}


Here I'm using the Map() function of the Collection class. there is a lot of useful methods provided by this class.






share|improve this answer


























  • I have $this->filterValues variable which contains mappings you speak of. This is not my issue, it is that I can't forward arbitrary number of filters

    – Norgul
    Nov 25 '18 at 20:56











  • Yes you can. The where clause accepts also an array of elements of the form: where([['key', 'operator', 'value'], [...])

    – HCK
    Nov 25 '18 at 21:01











  • I am aware of multiple where clause but even if I return my values imploded by comma and between [ ] it doesn't get parsed right

    – Norgul
    Nov 25 '18 at 21:02






  • 1





    @Norgul does your $filers array also contains the key value? (that I mentionend previosly)

    – HCK
    Nov 25 '18 at 21:05











  • Oh it's about array keys! That solves it, thanks!

    – Norgul
    Nov 25 '18 at 21:08



















0














You may follow this way



DB::table('users')
->where(function($query) use ($filter)
{
// You able to access $filter here
// You may able to to generate this block by loop
$query->where('votes', '>', 100)
->where('title', '<>', 'Admin');
})
->get();


Laravel Doc | Advanced Wheres



Exp-1



    $filters = [
['key' => 'votes', 'operator' => '>', 'value' => 100]
];

DB::table('users')
->where(function ($query) use ($filters) {
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['operator'] && @$filter['value']) {
$query->where($filter['key'], $filter['operator'], $filter['value']);
}
}
})->get();


Exp-2



    $filters = [
['key' => 'votes', 'operator' => '>', 'value' => 100]
];

DB::table('users')
->where(function ($query) use ($filters) {
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['operator'] && @$filter['value']) {
$query->whereRaw("{$filter['key']} {$filter['operator']} '{$filter['value']}'");
}
}
})->get();



You may also use scope function Ref




Exp-3 Laravel Scope



class User extends Model
{
public function scopeFilter($query, $filters)
{
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['value']) {
$query->where($filter['key'], @$filter['operator']?:"=", $filter['value']);
}
}

return $query;
}
}

// Use
User::filter($filters)->get();





share|improve this answer


























  • Sorry but this doesn't quite answer my question. I am already trying to resolve it with loops, however the format which I need to provide to where() is what is preventing me to do so. Even with advanced wheres I still don't know how I am supposed to format it.

    – Norgul
    Nov 25 '18 at 20:32











  • @Norgul Check Exp(s)

    – absiddiqueLive
    Nov 26 '18 at 9:40











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53471348%2flaravel-variable-to-where-clause%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0
















Not the nicest way to solve it, but this should work:



private function filterConverter($filters)
{
return collect($filters)->map(function ($filter) { // <---
if($filter['operator'] == 'CONTAINS')
{
$filter['value'] = '%' . $filter['value'] . '%';
$filter['operator'] = 'LIKE';
}
else if ($filter['operator'] == 'EQUALS')
{
$filter['operator'] = '=';
}

return collect($filter)->flatten(); // <---
})->toArray(); // <---
}


Here I'm using the Map() function of the Collection class. there is a lot of useful methods provided by this class.






share|improve this answer


























  • I have $this->filterValues variable which contains mappings you speak of. This is not my issue, it is that I can't forward arbitrary number of filters

    – Norgul
    Nov 25 '18 at 20:56











  • Yes you can. The where clause accepts also an array of elements of the form: where([['key', 'operator', 'value'], [...])

    – HCK
    Nov 25 '18 at 21:01











  • I am aware of multiple where clause but even if I return my values imploded by comma and between [ ] it doesn't get parsed right

    – Norgul
    Nov 25 '18 at 21:02






  • 1





    @Norgul does your $filers array also contains the key value? (that I mentionend previosly)

    – HCK
    Nov 25 '18 at 21:05











  • Oh it's about array keys! That solves it, thanks!

    – Norgul
    Nov 25 '18 at 21:08
















0
















Not the nicest way to solve it, but this should work:



private function filterConverter($filters)
{
return collect($filters)->map(function ($filter) { // <---
if($filter['operator'] == 'CONTAINS')
{
$filter['value'] = '%' . $filter['value'] . '%';
$filter['operator'] = 'LIKE';
}
else if ($filter['operator'] == 'EQUALS')
{
$filter['operator'] = '=';
}

return collect($filter)->flatten(); // <---
})->toArray(); // <---
}


Here I'm using the Map() function of the Collection class. there is a lot of useful methods provided by this class.






share|improve this answer


























  • I have $this->filterValues variable which contains mappings you speak of. This is not my issue, it is that I can't forward arbitrary number of filters

    – Norgul
    Nov 25 '18 at 20:56











  • Yes you can. The where clause accepts also an array of elements of the form: where([['key', 'operator', 'value'], [...])

    – HCK
    Nov 25 '18 at 21:01











  • I am aware of multiple where clause but even if I return my values imploded by comma and between [ ] it doesn't get parsed right

    – Norgul
    Nov 25 '18 at 21:02






  • 1





    @Norgul does your $filers array also contains the key value? (that I mentionend previosly)

    – HCK
    Nov 25 '18 at 21:05











  • Oh it's about array keys! That solves it, thanks!

    – Norgul
    Nov 25 '18 at 21:08














0












0








0









Not the nicest way to solve it, but this should work:



private function filterConverter($filters)
{
return collect($filters)->map(function ($filter) { // <---
if($filter['operator'] == 'CONTAINS')
{
$filter['value'] = '%' . $filter['value'] . '%';
$filter['operator'] = 'LIKE';
}
else if ($filter['operator'] == 'EQUALS')
{
$filter['operator'] = '=';
}

return collect($filter)->flatten(); // <---
})->toArray(); // <---
}


Here I'm using the Map() function of the Collection class. there is a lot of useful methods provided by this class.






share|improve this answer

















Not the nicest way to solve it, but this should work:



private function filterConverter($filters)
{
return collect($filters)->map(function ($filter) { // <---
if($filter['operator'] == 'CONTAINS')
{
$filter['value'] = '%' . $filter['value'] . '%';
$filter['operator'] = 'LIKE';
}
else if ($filter['operator'] == 'EQUALS')
{
$filter['operator'] = '=';
}

return collect($filter)->flatten(); // <---
})->toArray(); // <---
}


Here I'm using the Map() function of the Collection class. there is a lot of useful methods provided by this class.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 25 '18 at 21:09

























answered Nov 25 '18 at 20:48









HCKHCK

3,62711338




3,62711338













  • I have $this->filterValues variable which contains mappings you speak of. This is not my issue, it is that I can't forward arbitrary number of filters

    – Norgul
    Nov 25 '18 at 20:56











  • Yes you can. The where clause accepts also an array of elements of the form: where([['key', 'operator', 'value'], [...])

    – HCK
    Nov 25 '18 at 21:01











  • I am aware of multiple where clause but even if I return my values imploded by comma and between [ ] it doesn't get parsed right

    – Norgul
    Nov 25 '18 at 21:02






  • 1





    @Norgul does your $filers array also contains the key value? (that I mentionend previosly)

    – HCK
    Nov 25 '18 at 21:05











  • Oh it's about array keys! That solves it, thanks!

    – Norgul
    Nov 25 '18 at 21:08



















  • I have $this->filterValues variable which contains mappings you speak of. This is not my issue, it is that I can't forward arbitrary number of filters

    – Norgul
    Nov 25 '18 at 20:56











  • Yes you can. The where clause accepts also an array of elements of the form: where([['key', 'operator', 'value'], [...])

    – HCK
    Nov 25 '18 at 21:01











  • I am aware of multiple where clause but even if I return my values imploded by comma and between [ ] it doesn't get parsed right

    – Norgul
    Nov 25 '18 at 21:02






  • 1





    @Norgul does your $filers array also contains the key value? (that I mentionend previosly)

    – HCK
    Nov 25 '18 at 21:05











  • Oh it's about array keys! That solves it, thanks!

    – Norgul
    Nov 25 '18 at 21:08

















I have $this->filterValues variable which contains mappings you speak of. This is not my issue, it is that I can't forward arbitrary number of filters

– Norgul
Nov 25 '18 at 20:56





I have $this->filterValues variable which contains mappings you speak of. This is not my issue, it is that I can't forward arbitrary number of filters

– Norgul
Nov 25 '18 at 20:56













Yes you can. The where clause accepts also an array of elements of the form: where([['key', 'operator', 'value'], [...])

– HCK
Nov 25 '18 at 21:01





Yes you can. The where clause accepts also an array of elements of the form: where([['key', 'operator', 'value'], [...])

– HCK
Nov 25 '18 at 21:01













I am aware of multiple where clause but even if I return my values imploded by comma and between [ ] it doesn't get parsed right

– Norgul
Nov 25 '18 at 21:02





I am aware of multiple where clause but even if I return my values imploded by comma and between [ ] it doesn't get parsed right

– Norgul
Nov 25 '18 at 21:02




1




1





@Norgul does your $filers array also contains the key value? (that I mentionend previosly)

– HCK
Nov 25 '18 at 21:05





@Norgul does your $filers array also contains the key value? (that I mentionend previosly)

– HCK
Nov 25 '18 at 21:05













Oh it's about array keys! That solves it, thanks!

– Norgul
Nov 25 '18 at 21:08





Oh it's about array keys! That solves it, thanks!

– Norgul
Nov 25 '18 at 21:08













0














You may follow this way



DB::table('users')
->where(function($query) use ($filter)
{
// You able to access $filter here
// You may able to to generate this block by loop
$query->where('votes', '>', 100)
->where('title', '<>', 'Admin');
})
->get();


Laravel Doc | Advanced Wheres



Exp-1



    $filters = [
['key' => 'votes', 'operator' => '>', 'value' => 100]
];

DB::table('users')
->where(function ($query) use ($filters) {
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['operator'] && @$filter['value']) {
$query->where($filter['key'], $filter['operator'], $filter['value']);
}
}
})->get();


Exp-2



    $filters = [
['key' => 'votes', 'operator' => '>', 'value' => 100]
];

DB::table('users')
->where(function ($query) use ($filters) {
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['operator'] && @$filter['value']) {
$query->whereRaw("{$filter['key']} {$filter['operator']} '{$filter['value']}'");
}
}
})->get();



You may also use scope function Ref




Exp-3 Laravel Scope



class User extends Model
{
public function scopeFilter($query, $filters)
{
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['value']) {
$query->where($filter['key'], @$filter['operator']?:"=", $filter['value']);
}
}

return $query;
}
}

// Use
User::filter($filters)->get();





share|improve this answer


























  • Sorry but this doesn't quite answer my question. I am already trying to resolve it with loops, however the format which I need to provide to where() is what is preventing me to do so. Even with advanced wheres I still don't know how I am supposed to format it.

    – Norgul
    Nov 25 '18 at 20:32











  • @Norgul Check Exp(s)

    – absiddiqueLive
    Nov 26 '18 at 9:40
















0














You may follow this way



DB::table('users')
->where(function($query) use ($filter)
{
// You able to access $filter here
// You may able to to generate this block by loop
$query->where('votes', '>', 100)
->where('title', '<>', 'Admin');
})
->get();


Laravel Doc | Advanced Wheres



Exp-1



    $filters = [
['key' => 'votes', 'operator' => '>', 'value' => 100]
];

DB::table('users')
->where(function ($query) use ($filters) {
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['operator'] && @$filter['value']) {
$query->where($filter['key'], $filter['operator'], $filter['value']);
}
}
})->get();


Exp-2



    $filters = [
['key' => 'votes', 'operator' => '>', 'value' => 100]
];

DB::table('users')
->where(function ($query) use ($filters) {
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['operator'] && @$filter['value']) {
$query->whereRaw("{$filter['key']} {$filter['operator']} '{$filter['value']}'");
}
}
})->get();



You may also use scope function Ref




Exp-3 Laravel Scope



class User extends Model
{
public function scopeFilter($query, $filters)
{
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['value']) {
$query->where($filter['key'], @$filter['operator']?:"=", $filter['value']);
}
}

return $query;
}
}

// Use
User::filter($filters)->get();





share|improve this answer


























  • Sorry but this doesn't quite answer my question. I am already trying to resolve it with loops, however the format which I need to provide to where() is what is preventing me to do so. Even with advanced wheres I still don't know how I am supposed to format it.

    – Norgul
    Nov 25 '18 at 20:32











  • @Norgul Check Exp(s)

    – absiddiqueLive
    Nov 26 '18 at 9:40














0












0








0







You may follow this way



DB::table('users')
->where(function($query) use ($filter)
{
// You able to access $filter here
// You may able to to generate this block by loop
$query->where('votes', '>', 100)
->where('title', '<>', 'Admin');
})
->get();


Laravel Doc | Advanced Wheres



Exp-1



    $filters = [
['key' => 'votes', 'operator' => '>', 'value' => 100]
];

DB::table('users')
->where(function ($query) use ($filters) {
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['operator'] && @$filter['value']) {
$query->where($filter['key'], $filter['operator'], $filter['value']);
}
}
})->get();


Exp-2



    $filters = [
['key' => 'votes', 'operator' => '>', 'value' => 100]
];

DB::table('users')
->where(function ($query) use ($filters) {
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['operator'] && @$filter['value']) {
$query->whereRaw("{$filter['key']} {$filter['operator']} '{$filter['value']}'");
}
}
})->get();



You may also use scope function Ref




Exp-3 Laravel Scope



class User extends Model
{
public function scopeFilter($query, $filters)
{
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['value']) {
$query->where($filter['key'], @$filter['operator']?:"=", $filter['value']);
}
}

return $query;
}
}

// Use
User::filter($filters)->get();





share|improve this answer















You may follow this way



DB::table('users')
->where(function($query) use ($filter)
{
// You able to access $filter here
// You may able to to generate this block by loop
$query->where('votes', '>', 100)
->where('title', '<>', 'Admin');
})
->get();


Laravel Doc | Advanced Wheres



Exp-1



    $filters = [
['key' => 'votes', 'operator' => '>', 'value' => 100]
];

DB::table('users')
->where(function ($query) use ($filters) {
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['operator'] && @$filter['value']) {
$query->where($filter['key'], $filter['operator'], $filter['value']);
}
}
})->get();


Exp-2



    $filters = [
['key' => 'votes', 'operator' => '>', 'value' => 100]
];

DB::table('users')
->where(function ($query) use ($filters) {
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['operator'] && @$filter['value']) {
$query->whereRaw("{$filter['key']} {$filter['operator']} '{$filter['value']}'");
}
}
})->get();



You may also use scope function Ref




Exp-3 Laravel Scope



class User extends Model
{
public function scopeFilter($query, $filters)
{
foreach ($filters as $filter) {
if (@$filter['key'] && @$filter['value']) {
$query->where($filter['key'], @$filter['operator']?:"=", $filter['value']);
}
}

return $query;
}
}

// Use
User::filter($filters)->get();






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 26 '18 at 15:44

























answered Nov 25 '18 at 20:15









absiddiqueLiveabsiddiqueLive

3,62321427




3,62321427













  • Sorry but this doesn't quite answer my question. I am already trying to resolve it with loops, however the format which I need to provide to where() is what is preventing me to do so. Even with advanced wheres I still don't know how I am supposed to format it.

    – Norgul
    Nov 25 '18 at 20:32











  • @Norgul Check Exp(s)

    – absiddiqueLive
    Nov 26 '18 at 9:40



















  • Sorry but this doesn't quite answer my question. I am already trying to resolve it with loops, however the format which I need to provide to where() is what is preventing me to do so. Even with advanced wheres I still don't know how I am supposed to format it.

    – Norgul
    Nov 25 '18 at 20:32











  • @Norgul Check Exp(s)

    – absiddiqueLive
    Nov 26 '18 at 9:40

















Sorry but this doesn't quite answer my question. I am already trying to resolve it with loops, however the format which I need to provide to where() is what is preventing me to do so. Even with advanced wheres I still don't know how I am supposed to format it.

– Norgul
Nov 25 '18 at 20:32





Sorry but this doesn't quite answer my question. I am already trying to resolve it with loops, however the format which I need to provide to where() is what is preventing me to do so. Even with advanced wheres I still don't know how I am supposed to format it.

– Norgul
Nov 25 '18 at 20:32













@Norgul Check Exp(s)

– absiddiqueLive
Nov 26 '18 at 9:40





@Norgul Check Exp(s)

– absiddiqueLive
Nov 26 '18 at 9:40


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53471348%2flaravel-variable-to-where-clause%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen