This commit is contained in:
James Cole 2018-08-17 05:54:29 +02:00
parent 3ca3ce0726
commit 219a0cd612
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
4 changed files with 17 additions and 3 deletions

View File

@ -323,7 +323,7 @@ class ReportController extends Controller
$accounts = implode(',', $request->getAccountList()->pluck('id')->toArray());
$categories = implode(',', $request->getCategoryList()->pluck('id')->toArray());
$budgets = implode(',', $request->getBudgetList()->pluck('id')->toArray());
$tags = implode(',', $request->getTagList()->pluck('tag')->toArray());
$tags = implode(',', $request->getTagList()->pluck('id')->toArray());
$expense = implode(',', $request->getExpenseList()->pluck('id')->toArray());
$uri = route('reports.index');

View File

@ -213,6 +213,12 @@ class ReportFormRequest extends Request
$tag = $repository->findByTag($tagTag);
if (null !== $tag) {
$collection->push($tag);
continue;
}
$tag = $repository->findNull((int)$tagTag);
if (null !== $tag) {
$collection->push($tag);
continue;
}
}
}

View File

@ -45,6 +45,7 @@ class TagList implements BinderInterface
{
if (auth()->check()) {
$list = array_unique(array_map('\strtolower', explode(',', $value)));
Log::debug('List of tags is', $list);
if (0 === \count($list)) {
Log::error('Tag list is empty.');
throw new NotFoundHttpException; // @codeCoverageIgnore
@ -56,7 +57,14 @@ class TagList implements BinderInterface
$collection = $allTags->filter(
function (Tag $tag) use ($list) {
return \in_array(strtolower($tag->tag), $list, true);
if(\in_array(strtolower($tag->tag), $list, true)) {
return true;
}
if(\in_array((string)$tag->id, $list, true)) {
return true;
}
return false;
}
);

View File

@ -3,7 +3,7 @@
<div class="col-sm-9">
<select id="inputTags" name="tag[]" multiple="multiple" class="form-control">
{% for tag in tags %}
<option value="{{ tag.tag }}" label="{{ tag.tag }}">{{ tag.tag }}</option>
<option value="{{ tag.id }}" label="{{ tag.tag|e('html') }}">{{ tag.tag|e('html') }}</option>
{% endfor %}
</select>
</div>