Comments (8)
The standard belongsTo
relationship is supported for v1.
I still want Blueprint to generate additional relationships like the corresponding hasOne
relationship, as well as hasMany
. But I'm want to determine a streamlined syntax for the latter as well as supporting existing models.
As such, retagging this for post v1.
from blueprint.
Is there any ETA on this, as this is the only thing stopping me from using this on a large project ?
from blueprint.
@MattHadfield113, what exactly are you waiting on?
from blueprint.
@jasonmccreary the syntax and ways for generating a hasMany or hasOne relationship, as those are quite critical to most projects with relational data and would be great to have them premade rather than generating all the models then having to edit them to add the hasMany or hasOne relationships after the fact.
from blueprint.
@MattHadfield113, you do realize right now you're writing everything manually. So Blueprint still provides a lot of value. Seems knee-jerk to have this single item stop you from using it.
I welcome any syntax suggestions or PRs for adding this. Otherwise, there's no ETA.
This is on the list, just don't know when I'll come back to it as nested namespaces and test generation are my priorities at the moment.
from blueprint.
@jasonmccreary im currently using https://github.com/pipe-dream/laravel-create instead, which does quite a bit of the work, however Blueprint takes this a whole step further. Very excited to see this in full swing.
from blueprint.
The beginnings of this were merged in PR #72 and will be tagged shortly.
from blueprint.
i just want to make this work :
models:
Product:
user_id: id foreign:users.id
slug: string:400 unique
name: string:400
description: longtext
status: string:400 default:draft
variable: booleon default:true
relationships:
belongsTo: Category
belongsToMany: Order
hasMany: Variant, Review
morphOne: Price, Meta
morphToMany: Media, Tag
Price:
user_id: id foreign:users.id
price: integer dafault:0
compare_at_price: integer default:0
cost_price: integer dafault:0
shipping_price: integer dafault:0
tax: integer dafault:0
relationships:
morphTo: Product, Variant
Variant:
user_id: id foreign:users.id
product_id: id foreign:products.id
option: string:400
value: string:400
display: string:400
relationships:
belongsTo: Product
morphOne: Price, Meta
morphToMany: Media, Tag
Meta:
user_id: id foreign:users.id
seo_title: string:400
seo_description: longText
relationships:
morphTo: Product, Variant, Category, Blog
morphToMany: Media
Tag:
user_id: id foreign:users.id
name: string:400 unique
relationships:
morphedByMany: Product, Category, Blog
Media:
user_id: id foreign:users.id
url: string:400
alt: string:400
type: string:400
relationships:
morphedByMany: Product, Variant, Category, Blog, Meta, Review
Order:
slug: string:400 unique
user_id: id foreign:users.id
transaction_id: string:400
total: integer dafault:0
status: string:400 default:draft
description: longText nullable
relationships:
belongsTo: User
hasOne: Address
hasMany: Products
Address:
user_id: id foreign:users.id
order_id: id foreign:orders.id nullable
primary: boolean default:false
country: string:400
street_line_1: string:400
street_line_2: string:400 nullable
city: string:400
state: string:400
zip_code: string:400
relationships:
belongsTo: Order
Review:
user_id: id foreign:users.id
product_id: id foreign:products.id
content: longtext
star: integer dafault:0
Category:
slug: string:400 unique
user_id: id foreign:users.id
product_id: id foreign:products.id
name: string:400
description: longText
relationships:
morphOne: Meta
hasMany: Product
Blog:
slug: string:400 unique
user_id: id foreign:users.id
name: string:400
content: longText
relationships:
belongsTo: User
morphOne: Meta
morphToMany: Media, Tag
controllers:
Omni:
resource
Product:
resource
Category:
resource
Blog:
resource
but as soon as I run blueprint:build it returns this:
pa blueprint:build
ErrorException
Undefined index: morphtomany
from blueprint.
Related Issues (20)
- Change generator methods visibility from "private" to "protected" HOT 2
- belongsToMany Foreign UUID not working. HOT 18
- Add in already on going project HOT 4
- Plural route naming convention as default to match Laravel docs HOT 1
- HasMany function generation: function name has full namespaced model name instead of only model name HOT 2
- Pluralization oddity HOT 5
- [Internal] Improve "Demo" Workflow
- request to add indexes example on the docs HOT 1
- Laravel 11 Compatibility HOT 4
- Wrong faker for string column type with max chars HOT 1
- Table name set via meta is not honoured by foreign keys HOT 1
- Explicit foreign not explicit HOT 13
- Split Laravel blueprint and project codebase -> declarative programming HOT 1
- Need to create service file using custom stubs.
- Generate model relations
- Renaming relationship for belongsToMany
- Renaming relationship for belongsToMany HOT 2
- Incorrect faker provider generated from column defined as "name: enum"
- Indicate where the problem in the YAML file is HOT 1
- Migration creates 2 columns when related model name contains number HOT 1
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 blueprint.