check if values are array
This commit is contained in:
parent
4c3b0afe1f
commit
7d1a6e87c0
|
|
@ -74,11 +74,19 @@ public function setup()
|
|||
], function() {
|
||||
return Country::all()->pluck('name', 'id')->toArray();
|
||||
}, function($values) {
|
||||
//$values = is_array($values)?$values:array($values);
|
||||
foreach (json_decode(implode($values)) as $key => $value) {
|
||||
$this->crud->query = $this->crud->query->whereHas('countries', function ($query) use ($value) {
|
||||
$query->where('country_id', $value);
|
||||
});
|
||||
if(!is_array($values)){
|
||||
foreach (json_decode($values) as $key => $value) {
|
||||
$this->crud->query = $this->crud->query->whereHas('countries', function ($query) use ($value) {
|
||||
$query->where('country_id', $value);
|
||||
});
|
||||
}
|
||||
}
|
||||
else{
|
||||
foreach ($values as $key => $value) {
|
||||
$this->crud->query = $this->crud->query->whereHas('countries', function ($query) use ($value) {
|
||||
$query->where('country_id', $value);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue