Closed mostafaznv closed 6 years ago
Yes, this is intended behavior as we try to make this package flexible in accepting any kind of inputs, and then check data type & accordingly decide how to treat it, so if you're passing integers make sure to cast it first before passing to any of this package's methods.
As i understand, we can't use this package with UUID primary keys?
I didn't try it, but I guess you can do it by overriding the model and maybe the migration. The model is easily configurable through config options, so no core changes needed.
ok, thanks I'll try it
Got a similar issue related, solved it this way:
$category_ids = $request->input('category_ids'); // ["1", "2"]
$category_ids = array_map('intval', $category_ids); // [1, 2]
$categorizable_model->syncCategories($category_ids);
Thank you for your patience, this has been fixed in recent commit too https://github.com/rinvex/laravel-categories/commit/8ca17e72ed7849a9d38a5aecda954c3a81cc2938
Hi,
Thanks for this nice package. I need to cast all ID and primary keys to string because of client-side reasons. and I found an issue on this matter. all query scopes doesn't work with string.
example:
Model::withCategories([1, 2])->get();
workedModel::withCategories(["1", "2"])->get();
empty response