1
I have several 4 tables Starting with Users -> Departments -> categoria_departamento -> category -> posts; Where the categoria_department table it serves as pivot for relation Many to Many between the departments table and the category table.
These are the last 4 tables.
When I enter the Category model and having to do a belongsToMany in the Department model appears a Fatalthrowableerror saying that my class was found (Class 'Department::class' not found) I’m doing it like this, in the Category.php model:
public function departamentos()
{
return $this->belongsToMany('Departamento::class', 'categoria_departamento');
}
And in the model Departments I did so see:
public function categorias()
{
return $this->belongsToMany('Categoria::class' , 'categoria_departamento');
}
I really don’t know why you’re making this mistake. What I’m doing wrong?
Remove the quotation marks where you have ::class
– novic
No vei... I can’t believe I didn’t think it could be the quotes.. kkkkkkkk Caracas man. Straight
– Natan Melo
Because with some you have to have highs and others don’t?
– Natan Melo
I don’t understand Natan the last question!
– novic
Automatic corrector changed the word. The question is. PQ with some relationships need quotes and others do not?
– Natan Melo
The more you solve the problem.
– Natan Melo
It all depends on how you use it as described in my answer or Department::class or "App Department" which means the same thing ... ! ;) vlw
– novic