Retrieve Id from another Controller than put it in View
I want to get order_id from OrdersController than put that order_id into input tag in view (OrderDetail)
can someone help me with it?
How are you returning the OrderDetail view?
public function order_product($id)
{
$orders = Order::find($id);
return view('orderdetails.create', compact('orders'));
}
class OrdersController extends Controller
{
public function myFunction(Request $request)
{
$order_id = $request('order_id'); //or however you retrieve order_id
return view('OrderDetail',['order_id' => $order_id]) //or compact('order_id')
}
}
then in OrderDetail.blade.php
<input type="text" name="name" value="{{ $order_id }}"> //or whatever you want to do with order_id
Please or to participate in this conversation.