Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add random associations for Artist -> Label in seeded data #68

Open
poppabear8883 opened this issue Sep 13, 2018 · 2 comments
Open

Add random associations for Artist -> Label in seeded data #68

poppabear8883 opened this issue Sep 13, 2018 · 2 comments
Labels
Milestone

Comments

@poppabear8883
Copy link
Contributor

As the title suggests, we are missing this piece of data to be able to test this relationship properly

@poppabear8883 poppabear8883 added this to the Seeds milestone Sep 13, 2018
@cbj4074
Copy link
Member

cbj4074 commented Sep 13, 2018

This is possible using the Factory State:

https://github.com/indiehd/web-api/blob/master/database/factories/ArtistFactory.php#L11

For example:

$ php artisan tinker
Psy Shell v0.9.7 (PHP 7.2.9-1+ubuntu18.04.1+deb.sury.org+1 — cli) by Justin Hileman
>>> factory(\App\Artist::class)->states('onLabel')->create();
=> App\Artist {#2955
     label_id: 38,
     updated_at: "2018-09-13 23:06:38",
     created_at: "2018-09-13 23:06:38",
     id: 88,
   }
>>> \App\Artist::find(88)->label;
=> App\Label {#2925
     id: 38,
     created_at: "2018-09-13 23:06:38",
     updated_at: "2018-09-13 23:06:38",
   }

Will that satisfy the need at hand?

@poppabear8883
Copy link
Contributor Author

For now it solves what I was currently working on, but this issue still needs addressed as we discussed on discord:

the issue is that when you run --seed these associations are not there
so we need to make it where we can add a number of artists to random labels just for dummy data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants