A
A
Alexander2017-05-26 11:58:55
ORM
Alexander, 2017-05-26 11:58:55

How to arrange the structure of directories in Eloquent?

At the moment there is such a database structure for the implementation of the directory. It does not imply the storage of nested directories, but this is not so critical at the current stage.
58f20388063745d9a7a6ec13deb2ef1e.jpg
Different types of models may contain reference information that must be collected as model attributes. The binding to models goes through the catalog_values ​​table . The essence of the question is whether it is possible to assemble a model in Eloquent in such a way that it would contain an array of attributes filled from two related tables through the same catalog_values ​​?

Class Book {
  $attributes = [
    [
       'title' => 'Вес',
       'field' => 'г',
       'value' => '120'
    ]
  ]
}

Or maybe the structure is not initially correct and there is a more correct solution to this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vism, 2017-05-26
@TehekOne

Simply put, an Eloquent model is a representation of a database table in code.
Write a class that will collect a collection from EAV

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question