Laravel Seeds: 3-Level Relationships and Fake Images

preview_player
Показать описание
When seeding fake data, how can you deal with hasMany relationships, and fake images, like user avatars? Let me show you.

- - - - -
Support the channel by checking out our products:
Рекомендации по теме
Комментарии
Автор

Thank you, Povilas! In general, I did not find much information about the creation of fake data with examples on the Internet. And here is a very useful one.

misha-pitegorsk
Автор

Hello Povilas, thanks for the great video. My suggestion would be to be a bit smaller:

User::factory()
->count(10)
->has(Project::factory()
->count(10)

)
->create();
The has() and for() functionality in factories is very nice if you already build the relationship in the model itself. I would love to see an update of this with it :)

Elelalem
Автор

Really miss this short video like this povilas, great video

Luthfi
Автор

Thanks for this vídeo... the way that blueprint does seeds is very interessant

pauloclara
Автор

Yes, the same question about deleting fake images after migrate:fresh

VitaliyHAN
Автор

Perfect ! It's very useful, thanks 🙏

chlouis-girardot
Автор

Hey sir, thanks once again for the guide. It really help me, anyway do you know how to put logic in the factory?

kito
Автор

Hi,
Can I use inertia with multiple views? one for admin and other for users?
tnx

EL_PANDA_
Автор

Thanks for the content. What if I want to be able to seed directly a Task or a Project, with dedicated clsses? How do I supply the project_id or user_id in this case?

MarcoMasi-masiorama
Автор

Awesome. Just about to ask the same question

amirulidzham
Автор

One thing I miss with the image seeder is an offline way to do this or something similar (randomly generated gradient orsmth). I've had moments where the service was unreachable, insecure (old ssl cert), or just plain unusable for a seeding a big seed (it doesn't re-use a local cache either). Could be better (:

Xewl
Автор

Hi, thanks for the awesome daily videos. What would be a good approach in developing a multi-module application. For example, a HR module, Accounting module, Billing module, etc. such that each module can be separately plugged into another project with minimal configuration? Any suggestions would help. Thanks

umahatokula
Автор

Thanks a lot for your excellent content.
We need guide for product variants best practices <3

vitalikartsivadze
Автор

How to seed categories table that has a patent_category_id column?

souravkumarpradhan
Автор

really like image generation with faker and saving on path.

popetgirl
Автор

And how to properly delete these fake images on migrate:refresh?

mrAzrarn
Автор

Hi Povilas, great video, I have tried something like that a few months ago, it works fine but performance is not ideal as I am always reseeding every few days,
I got it to be perromant by creatind the first level models first, then taking the first level model keys to generate the second level models and so on.
Maybe someone has a better solution but this is what worked for me

tinmancode
Автор

please can you talk about soowle php and and reactPhp any thing can help

-chaaoui
Автор

Hello, Thanks for the interesting videos you share for free. However, when I run this line:
"$this->faker->image('app/public/avatars',

PhpUnit tells me that I don't have write permission for the path: "app/public/avatars".

Can someone help me with this bug?

Note: I have already created the public storage link

abdourahmanediop
Автор

How about refactoring that to single responsibility?

alexaverkiyev