IsraelOrtuno / Eavquent

EAV modeling package for Laravel and Eloquent – This package is abandoned, please use this fork https://github.com/rinvex/attributes
63 stars 13 forks source link

Call to undefined method Illuminate\Database\Query\Builder::city() #42

Closed Chalkin closed 6 years ago

Chalkin commented 8 years ago

I have tried to get eavquent to work in a newly created Laravel Project (5.3.7) but when i try to retrieve the model object of customer, i get Call to undefined method Illuminate\Database\Query\Builder::city()

This is the repository: https://bitbucket.org/Klostermeier/eavquent/src

Table values:

eav_values_varchar INSERT INTOeav_values_varchar(id,content,attribute_id,entity_id) VALUES (1,'Madrid',1,1);

customers: INSERT INTOcustomers(id,name,user_id,created_at,updated_at) VALUES (1,'Dr. Barton Hane Sr.',1,'2016-09-08 21:54:51','2016-09-08 21:54:51');

eav_attributes: INSERT INTOeav_attributes(id,name,label,type,entity,collection,default_value) VALUES (1,'city','City','App\\Http\\Controllers\\Varchar','App\\Http\\Controllers\\Customer',0,NULL), (2,'facebook','Facebook','App\\Http\\Controllers\\Varchar','App\\Http\\Controllers\\Customer',0,NULL);

I can't find the problem which is causing it.

IsraelOrtuno commented 8 years ago

Have you registered an attribute for that entity?

Chalkin commented 8 years ago

Not sure because I have no idea how or where. What I did is adding the city and facebook attributes to eav_attributs via SQL

IsraelOrtuno commented 8 years ago
INSERT INTO `eav_attributes` (`id`, `name`, `label`, `type`, `entity`, `collection`, `default_value`)
VALUES
    (1, 'city', 'City', 'Devio\\Eavquent\\Value\\Data\\Varchar', 'Company', 0, NULL);

Instead of Company set your model path there App\\Customer in your case

Chalkin commented 8 years ago

Okay, right. The type path was wrong and the entity as well. So I changed it to the following but still the same error:

INSERT INTO `eav_attributes` (`id`, `name`, `label`, `type`, `entity`, `collection`, `default_value`) VALUES 
    (1,'city','City','Devio\\Eavquent\\Value\\Data\\Varchar','App\\Customer',0,NULL),
    (2,'facebook','Facebook','Devio\\Eavquent\\Value\\Data\\Varchar','App\\Customer',0,NULL);
IsraelOrtuno commented 8 years ago

Eitherway package is currently under development. Haven't tested with L5.3 yet. I will inform you when do.

Chalkin commented 8 years ago

okay, gonna try it with a 5.2 again. Will let you know.

Chalkin commented 8 years ago

Yep, in Laravel 5.2.45 it's working.

Do you have any timeline for the package or planed release? We are planing on using it on a project which will go live in about 2-3 months. We would like to use eavquent if it's released until then.

Meanwhile we can help in testing (by extensivly using it)

Chalkin commented 8 years ago

So, no timeline? No Changes the last 2 month - are you still developing on the package or is it basically dead?

IsraelOrtuno commented 8 years ago

I am currently developing. It's just a matter of time I cannot update as regularly as I wish 😢