2 years ago

In a blade view, check if there is a relation between two specific models

Posted 2 years ago by Filip_Zdravkovic

I have two models with Many-to-Many relationship:

  • User model (users table)
  • Robot model (robots table)
  • (and there is robot_user table)

There is a robot profile page (blade view) which displays some info about the specific robot. In that blade file, when a user is logged in - I need to check if there is a relationship between that specific robot and logged in user. What is the best way to do it, what's the most elegant way?

Please sign in or create an account to participate in this conversation.