← prev | next →
flyingdragons 2021-11-20 16:37:19
Without showing your code I cannot help much. Please share the Parent table migration and existing child table migration
skpnation 2021-11-20 16:37:52
flyingdragons 2021-11-20 16:38:29
skpnation 2021-11-20 16:37:52
This might be parent table. Right?
skpnation 2021-11-20 16:39:33
I don’t understand what you mean by parent table. I’m new to laravel
flyingdragons 2021-11-20 16:39:35
In orders table why are you using order_id column?
skpnation 2021-11-20 16:40:20
flyingdragons 2021-11-20 16:39:35
In orders table why are you using order_id column?
id inrements, as 1,2,3… I want the order id to be in uuid format
flyingdragons 2021-11-20 16:40:29
Eg: You have orders (parent table), order_items (child table) tables.
Now you want to add order_id (foreign key) in order_items table
skpnation 2021-11-20 16:41:34
I want to add vendor_id foreign key as well in order table. The vendor places the order
flyingdragons 2021-11-20 16:41:45
In order model put the following code
protected $primaryKey = ‘id’;
protected $keyType = ‘string’;
public $incrementing = false;
In migrations use the following
$table->uuid(‘id’)->primary();
flyingdragons 2021-11-20 16:42:32
skpnation 2021-11-20 16:41:34
I want to add vendor_id foreign key as well in order table. The vendor places the order
Already vendor_id is there in orders table
skpnation 2021-11-20 16:44:14
flyingdragons 2021-11-20 16:41:45
In order model put the following code
protected $primaryKey = ‘id’;
protected $keyType = ‘string’;
public $incrementing = false;
In migrations use the following
$table->uuid(‘id’)->primary();
Thanks man
skpnation 2021-11-20 16:44:49
You are now my mentor 🙏🏽
skpnation 2021-11-20 16:59:32
how can i place an order using a specific vendor_id so I can attach that vendor id as value to the vendor_id variable in that order?
flyingdragons 2021-11-20 17:01:54
skpnation 2021-11-20 16:59:32
how can i place an order using a specific vendor_id so I can attach that vendor id as value to the vendor_id variable in that order?
I am not sure but I think you might be displaying the products. And every products will be having vendors. So when your creating order make sure to pull the vendor_id from the products table.
skpnation 2021-11-20 17:04:56
flyingdragons 2021-11-20 17:01:54
I am not sure but I think you might be displaying the products. And every products will be having vendors. So when your creating order make sure to pull the vendor_id from the products table.
ok
skpnation 2021-11-20 17:05:07
Syntax error or access violation: 1072 Key column ‘vendor_id’ doesn’t exist in table (SQL: alter table orders add constraint orders_vendor_id_foreign foreign key (`vendor_id`) references vendors (`id`))
skpnation 2021-11-20 17:05:23
skpnation 2021-11-20 17:05:07
Syntax error or access violation: 1072 Key column ‘vendor_id’ doesn’t exist in table (SQL: alter table orders add constraint orders_vendor_id_foreign foreign key (`vendor_id`) references vendors (`id`))
I’m getting this error after trying to migrate:fresh
flyingdragons 2021-11-20 17:05:49
skpnation 2021-11-20 17:05:07
Syntax error or access violation: 1072 Key column ‘vendor_id’ doesn’t exist in table (SQL: alter table orders add constraint orders_vendor_id_foreign foreign key (`vendor_id`) references vendors (`id`))
Check in orders model fillable in vendor_id is added or not
flyingdragons 2021-11-20 17:06:07
Or show your order model
skpnation 2021-11-20 17:07:14
flyingdragons 2021-11-20 17:10:09
Whats the name of your vendors table
skpnation 2021-11-20 17:10:49
flyingdragons 2021-11-20 17:10:09
Whats the name of your vendors table
vendors
Sergio Araya 2021-11-20 17:11:03
2021-11-20 09:49:00
How to Highlight Mouse Pointer Windows 10
Easy
flyingdragons 2021-11-20 17:12:32
skpnation 2021-11-20 17:10:49
vendors
Are you running any alter query?
skpnation 2021-11-20 17:12:54
alter query?
skpnation 2021-11-20 17:13:10
I don’t think so. I don’t even know what that is
flyingdragons 2021-11-20 17:15:58
skpnation 2021-11-20 17:13:10
I don’t think so. I don’t even know what that is
Lets continue in private chat
Rao Aadil 2021-11-20 17:50:31
Rao Aadil 2021-11-20 12:46:28
I want to save image in public/storage/categories/FILE_NAME.
How Can I do that by sticking to the save method
anyOne????
flyingdragons 2021-11-20 18:00:07
Rao Aadil 2021-11-20 17:50:31
anyOne????
https://stackcoder.in/posts/file-upload-in-laravel-php
File Upload In Laravel PHP | StackCoder –
StackCoderIn this article lets get our hands dirty by working on File Upload In PHP Laravel.
Rao Aadil 2021-11-20 18:00:54
THNX
Rezi 2021-11-20 18:39:16
skpnation 2021-11-20 17:05:07
Syntax error or access violation: 1072 Key column ‘vendor_id’ doesn’t exist in table (SQL: alter table orders add constraint orders_vendor_id_foreign foreign key (`vendor_id`) references vendors (`id`))
show vendors migration table
skpnation 2021-11-20 18:41:19
Rezi 2021-11-20 18:39:16
show vendors migration table
solved.
Jon (he/him) 2021-11-20 18:42:27
2021-11-20 09:49:00
How to Highlight Mouse Pointer Windows 10
❓
skpnation 2021-11-20 18:43:01
skpnation 2021-11-20 18:43:16
← prev | next →