{"id":21089799,"url":"https://github.com/freshbitsweb/laravel-relationships-data","last_synced_at":"2025-05-16T13:30:49.420Z","repository":{"id":90033144,"uuid":"152415810","full_name":"freshbitsweb/laravel-relationships-data","owner":"freshbitsweb","description":"Migrations, seeders and factories to get up and running with various relationship types data quickly","archived":false,"fork":false,"pushed_at":"2019-04-02T05:44:45.000Z","size":546,"stargazers_count":26,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T01:24:02.603Z","etag":null,"topics":["factories","laravel","laravel-nova","migrations","relationships","seeders"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/freshbitsweb.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-10-10T11:54:40.000Z","updated_at":"2024-02-24T08:23:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"d15fefae-3afc-4cc5-b87d-e2c4023f377e","html_url":"https://github.com/freshbitsweb/laravel-relationships-data","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/freshbitsweb%2Flaravel-relationships-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freshbitsweb%2Flaravel-relationships-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freshbitsweb%2Flaravel-relationships-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freshbitsweb%2Flaravel-relationships-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/freshbitsweb","download_url":"https://codeload.github.com/freshbitsweb/laravel-relationships-data/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254538269,"owners_count":22087833,"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":["factories","laravel","laravel-nova","migrations","relationships","seeders"],"created_at":"2024-11-19T21:31:35.553Z","updated_at":"2025-05-16T13:30:49.412Z","avatar_url":"https://github.com/freshbitsweb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Laravel Relationships Data\n\nThis repo contains the migrations, seeders and factories to get up and running with various relationships types data quickly. Laravel provides support for many types relationships out-of-the-box. And when there is a need to play with any one of them to test something, I hate repeating the same stuff of creating migration and seeding the data before I can write code to actually test something.\n\nHere's how relationships are put here:\n\n|     Relationship Type    |   Model 1  |  Model 2 |\n|:------------------------:|:----------:|:--------:|\n|        One to One        |    User    |   Post   |\n|        One to Many       |    Post    | Comments |\n|       Many to Many       |    User    |   Role   |\n|     Has Many Through     |   Country  |   Phone  |\n|        Polymorphic       | Post/Video |   Like   |\n| Many to Many Polymorphic | Post/Video |    Tag   |\n\nAnd here is the ER Diagram image generated with [this lovely package](https://github.com/beyondcode/laravel-er-diagram-generator/) by [Marcel Pociot](https://twitter.com/marcelpociot).\n\n![Laravel Relationships Data](./graph.png \"Laravel Relationships Data\")\n\n## Laravel Nova Scaffolder\n\nThis repo also contains the necessary resource classes for each of the models to manage all the entities from the powerful Laravel Nova admin panel. Following are the steps to get you there in a few minutes:\n\n1) Clone the repo:\n```\ngit clone https://github.com/freshbitsweb/laravel-relationships-data.git [DIRECTORY_NAME]\n```\n\n2) Create `.env` file from the example file:\n```\ncomposer run-script post-root-package-install\n```\n\n3) Setup .env variables (Mainly the Database details and App URL)\n\n4) Install the dependencies and run migrations + seeders\n```\ncomposer install\ncomposer run-script post-create-project-cmd\nphp artisan migrate --seed\n```\n\n5) Install [Laravel Nova](https://nova.laravel.com/docs/1.0/installation.html#installing-nova)\n\n6) Head over to [APP_URL]/nova. You will see something like this on the post details page for example.\n\n![Laravel Nova Post Details Page](./laravel-nova-post-details-page.png \"Laravel Nova Post Details Page\")","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreshbitsweb%2Flaravel-relationships-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreshbitsweb%2Flaravel-relationships-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreshbitsweb%2Flaravel-relationships-data/lists"}