{"id":19150420,"url":"https://github.com/payter/has-column-many","last_synced_at":"2026-03-07T01:35:34.117Z","repository":{"id":57307163,"uuid":"479732425","full_name":"PayteR/has-column-many","owner":"PayteR","description":"Coma separated IDs, JSON and PHP Serialized relationships for Laravel Eloquent models","archived":false,"fork":false,"pushed_at":"2022-05-20T10:10:12.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-18T11:19:57.278Z","etag":null,"topics":["eloquent","eloquent-database","eloquent-models","eloquent-orm","eloquent-relations","eloquent-relationships","laravel","php"],"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/PayteR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-09T13:20:32.000Z","updated_at":"2023-08-08T09:32:35.000Z","dependencies_parsed_at":"2022-09-06T19:40:46.517Z","dependency_job_id":null,"html_url":"https://github.com/PayteR/has-column-many","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PayteR%2Fhas-column-many","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PayteR%2Fhas-column-many/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PayteR%2Fhas-column-many/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PayteR%2Fhas-column-many/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PayteR","download_url":"https://codeload.github.com/PayteR/has-column-many/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252819345,"owners_count":21809010,"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","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":["eloquent","eloquent-database","eloquent-models","eloquent-orm","eloquent-relations","eloquent-relationships","laravel","php"],"created_at":"2024-11-09T08:11:55.187Z","updated_at":"2026-03-07T01:35:34.057Z","avatar_url":"https://github.com/PayteR.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Comma separated IDs, JSON and PHP Serialized relationships for Laravel Eloquent models\n\nYou will be able to make relations of comma separated values in your MySQL table super easely, with adding just few lines of code into your Eloquent model. \n\nIt \n\nSo if you use Laravel and your relations in the table looks like this, then this package is for you:\n\n![Comma separated example](./docs/table-example.png)\n![PHP Serialized example](./docs/table-serialized-example.png)\n\n## Installation\n\nRequire package with composer\n\n```PHP\ncomposer require payter/has-column-many\n```\n\n## Basic usage\n\nUsing of this package is super easy - you just need to include `UseColumnMany` trait to your model.\n\n```PHP\n\u003c?php\nnamespace App\\Models;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse PayteR\\UseColumnMany;\n\nclass ModelName extends Model\n{\n    use UseColumnMany;\n\n    public function relateds()\n    {\n        return $this-\u003ehasColumnMany(RelatedModel::class, 'related_ids');\n    }\n}\n```\n\nAnd you can call it like any other [Eloquent relationships](https://laravel.com/docs/9.x/eloquent-relationships)\n\n```PHP\nuse App\\Models\\ModelName;\n \n$relateds = ModelName::find(1)-\u003erelateds;\n \nforeach ($relateds as $related) {\n    //\n}\n```\n\n## Advanced usage\n### Multiple columns\nYou are able to concat ID's even from more than one column! It's easy - just pass an array of column names as second parameter:\n```PHP\nreturn $this-\u003ehasColumnMany(RelatedModel::class, ['related_ids', 'another_column_ids']);\n```\n\n### JSON and Serialised ID's \n\nYou don't need to do anything, it will automatically asume if it's comma separated or JSON or Serialized.\n\n## You can \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpayter%2Fhas-column-many","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpayter%2Fhas-column-many","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpayter%2Fhas-column-many/lists"}