{"id":35063536,"url":"https://github.com/tishotm/eloquent-ci-relations","last_synced_at":"2025-12-27T11:00:46.411Z","repository":{"id":34978102,"uuid":"191497936","full_name":"TishoTM/eloquent-ci-relations","owner":"TishoTM","description":"Eloquent Case Insensitive Relations","archived":false,"fork":false,"pushed_at":"2025-05-30T11:17:03.000Z","size":54,"stargazers_count":6,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T00:12:49.168Z","etag":null,"topics":["case-insensitive","eloquent"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TishoTM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-06-12T04:32:21.000Z","updated_at":"2025-05-30T11:15:18.000Z","dependencies_parsed_at":"2024-04-06T16:31:21.774Z","dependency_job_id":null,"html_url":"https://github.com/TishoTM/eloquent-ci-relations","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":0.36,"last_synced_commit":"25308f69d84c969d9ba0be87893b6c060e8de786"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/TishoTM/eloquent-ci-relations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TishoTM%2Feloquent-ci-relations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TishoTM%2Feloquent-ci-relations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TishoTM%2Feloquent-ci-relations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TishoTM%2Feloquent-ci-relations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TishoTM","download_url":"https://codeload.github.com/TishoTM/eloquent-ci-relations/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TishoTM%2Feloquent-ci-relations/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28077909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-27T02:00:05.897Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["case-insensitive","eloquent"],"created_at":"2025-12-27T11:00:20.579Z","updated_at":"2025-12-27T11:00:46.406Z","avatar_url":"https://github.com/TishoTM.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Eloquent case-insensitive relations\n\n\u003cp align=\"left\"\u003e\n\u003ca href=\"https://github.com/TishoTM/eloquent-ci-relations/actions\"\u003e\u003cimg src=\"https://github.com/TishoTM/eloquent-ci-relations/actions/workflows/tests.yml/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/tishotm/eloquent-ci-relations\"\u003e\u003cimg class=\"badge\" src=\"https://poser.pugx.org/tishotm/eloquent-ci-relations/version\" alt=\"Version\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/tishotm/eloquent-ci-relations\"\u003e\u003cimg class=\"badge\" src=\"https://poser.pugx.org/tishotm/eloquent-ci-relations/downloads\" alt=\"Total Downloads\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/tishotm/eloquent-ci-relations\"\u003e\u003cimg class=\"badge\" src=\"https://poser.pugx.org/tishotm/eloquent-ci-relations/license\" alt=\"License\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nUsing Eloquent out of the box on case-insensitive collation databases could potentially return incomplete collection of items\nif the foreign keys are set as strings and they differ in terms of uppercase vs lowercase.\nOn eager loaded relations Eloquent builds a dictionary of the parent models and associates their related models by their keys.\nPHP is case-sensitive and therefore if the keys are different, then some of the related models will not be returned.\nThis package simply normalizes the dictionary keys into lowercase.\n\nExample:\n\n**Items table**\n\n| uuid | name |\n| --- | --- |\n| aaa | First |\n| bbb | Second |\n| ccc | Third |\n\n**Tags table**\n\n| id | label |\n| --- | --- |\n| 1 | tag 1 |\n| 2 | tag 2 |\n| 3 | tag 3 |\n\n**item_tag table**\n\n| item_uuid | tag_id |\n| --- | --- |\n| AAA | 1 |\n| aaa | 2 |\n| bbb | 3 |\n\n`Item::with('tags')-\u003efind('aaa');`\n\nThe related tags would include only the \"tag 2\" even if the the DB collation is case-insensitive and the returned query data includes \"tag 1\".\n\n**With case insensitive relations:** The related tags would include both \"tag 1\" and \"tag 2\".\n\n## Requirements\n\n- illuminate/database 5.5.33 and up, 5.6.\\*, 5.7.\\*, 5.8.\\*, 6.20.26 and up, 7.30.4, 8.40.0 an up\n\n## Installation\n\n`composer require tishotm/eloquent-ci-relations`\n\n## Usage\n\n```PHP\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\nclass Item extends Model\n{\n    use \\TishoTM\\Eloquent\\Concerns\\HasCiRelationships;\n\n    // ... relations\n}\n```\n\n## License\n\n[MIT license](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftishotm%2Feloquent-ci-relations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftishotm%2Feloquent-ci-relations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftishotm%2Feloquent-ci-relations/lists"}