Comments (2)
Well, nevermind my stupidity since there's a collection property for when creating attributes. I still have an issue though.
Testing in artisan tinker, and when I push a value and save the model, it doesn't update the collection. Example output from tinker:
>>> $product = Modules\Catalog\Models\Product::find(2);
=> Modules\Catalog\Models\Product {#3154
id: 2,
sku: "test",
name: "test",
family_id: 1,
product_brand_id: 1,
product_state_id: 1,
created_at: null,
updated_at: null,
deleted_at: null,
product_segment_id: 1,
product_manager: 1,
photo: null,
attribute-1: Rinvex\Attributes\Models\Type\Integer {#3184
id: 1,
content: 23,
attribute_id: 21,
entity_id: 2,
entity_type: "Modules\Catalog\Models\Product",
created_at: "2018-06-06 23:46:22",
updated_at: "2018-06-06 23:46:22",
},
attribute-1-fixed: null,
attribute-1-1: null,
description: Rinvex\Attributes\Models\Type\Varchar {#3194
id: 1,
content: "descrição produto #2",
attribute_id: 24,
entity_id: 2,
entity_type: "Modules\Catalog\Models\Product",
created_at: null,
updated_at: null,
},
file: null,
file-1: null,
option: App\Models\Option {#3216
id: 1,
content: 2,
attribute_id: 27,
entity_id: 2,
entity_type: "Modules\Catalog\Models\Product",
created_at: "2018-06-06 23:46:22",
updated_at: "2018-06-06 23:46:22",
},
options: Rinvex\Attributes\Support\ValueCollection {#3228
all: [
App\Models\Options {#3229
id: 1,
content: 1,
attribute_id: 29,
entity_id: 2,
entity_type: "Modules\Catalog\Models\Product",
created_at: "2018-06-07 00:08:39",
updated_at: "2018-06-07 00:08:39",
},
],
},
}
>>> $product->options->push("2")
=> Illuminate\Support\Collection {#3077
all: [
"1",
"2",
],
}
>>> $product->options
=> Illuminate\Support\Collection {#3141
all: [
"1",
],
}
>>> $product->save()
=> true
>>> $product->options
=> Illuminate\Support\Collection {#3225
all: [
"1",
],
}
from laravel-attributes.
This has been completely refactored in a different branch here:
https://github.com/rinvex/laravel-attributes/tree/refactor-to-native-laravel-relationships
In the new refactor, it actually uses normal relationships, and should be easy and straightforward like default Laravel relationships. Although, that refactor is incomplete. Any help with that branch would be much appreciated! 🙂
from laravel-attributes.
Related Issues (20)
- supporting Maria DB dynamic columns #1 HOT 1
- supporting Maria DB dynamic columns HOT 3
- ERROR: column "id" does not exist HOT 2
- Sortable attribute datetime HOT 1
- Lumen 8.x Installation Issue HOT 5
- jeremeamia/superclosure is abandoned HOT 1
- Class 'varchar' not found HOT 6
- How to work with Collections ? HOT 5
- Translations for Value content HOT 1
- Base table or view not found HOT 10
- How can I list out all of my attributes and values HOT 2
- List of available attributes for collection HOT 1
- Inserting values into a table that doesn't exist instead of attribute value table
- Attributable::relationsToArray() doesn't return entity attributes
- why we need to register entities? HOT 2
- Is there a plan to merge refactor-to-native-laravel-relationships ? HOT 1
- thank you for fantastic package HOT 1
- according to issue #158 HOT 3
- Laravel 9 support HOT 1
- 🟡 This package is abandoned and no longer maintained!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-attributes.