You want to store in the products table the same length and width as has been previously stored in that table???
Jul 7, 2022
9
Level 1
Laravel select by id
this is myproducts table
public function up()
{
Schema::create('products', function (Blueprint $table) {
$table->id();
$table->string('length')->nullable();
$table->string('width')->nullable();
$table->timestamps();
});
}
this is my db
id length width
1 300 400
2 350 500
3 430 125
4 980 410
this is store function in my controller
public function store(Request $request)
{
Product::create([
'length' => $request['length'],
'width' => $request['width'],
]);
return redirect()->route('products.create')
->with('success','product created successfully.');
}
i want that when i in create.blade.php SELECT(dropdown) id and click submit he saved in the db the length and width of this id ( from the same table ) I want the code for the backend to enter in store function
Please or to participate in this conversation.