Summer Sale! All accounts are 50% off this week.

s3nior's avatar

Addable power ups database schema

Aloha Folks,

im creating an app where users can add power ups to their online live video course.

So a course can have many powerUps, but a powerUp can be App\\Timer or App\\Recording or App\\ViewersCount, think you get it.

What im trying to do is, return all powerUps associated with a $course by calling the $course->powerUps relation.

Now, i thought it is easy to accomplish with morph relations, but i dont get it. How it should work.

How would you do it, when u want to use something like traits hasPowerUps or isPowerUp Any best practices for that?

$timer = Timer::find($id);

$videoCourse->addPowerUp($timer)

hope you understand what I want to do there. It should be testable and nice and clean :D

bye

Tobi

0 likes
0 replies

Please or to participate in this conversation.