是否可以使用我的数据库结构使用Laravel或Sql执行此查询?

I have a database with a table articles and a table category.

My table articles have some fields. And one that is category_id and a another orientation.

Categories, in my design, are arranged by orientation. Here is an example enter image description here

So, I would like to get all category BUT these categories must belong to the right orientation. I want list of all category who have articles with 'web' orientation, by example.

I do not know if it's possible with this architecture and if you understand me.

Any help is welcome

UPDATE : adding the schemas

enter image description here

If you have your models and relations set up, I believe this should do what you want:

$categories = Category::whereHas('articles', function($query) {
   $query->where('orientation', 'web')
})->get()

From the Laravel documentation:

If you need even more power, you may use the whereHas and orWhereHas methods to put "where" conditions on your has queries. These methods allow you to add customized constraints to a relationship constraint, such as checking the content of a comment