2 months ago

Sending and opening multiple varibles in the view.

Posted 2 months ago by Randy_Johnson

Hello, I am trying to make a create order page. I am just wondering what is the proper way of doing it.

Undefined variable: data (View: C:\Users\Josh\Desktop\websites\ecommerce\resources\views\admin\order\create.blade.php)
    public function create() 
        $data = [
            'users' => DB::table('users')->get(),
            'products' => DB::table('products')->get()
        return view($this->cv, [$this->table => $data]);
<form method="POST" action="/store-order">
                                <div class="form-group">
                                    <label for="exampleFormControlSelect1">User</label>
                                    <select name="kilogram" class="form-control">
                                    @foreach($data['users'] as $user)
                                <div class="form-group">
                                    <label for="exampleFormControlSelect1">Product</label>
                                    <select name="kilogram" class="form-control">
                                <button type="submit" class="btn btn-primary float-right">Create</button>

Please sign in or create an account to participate in this conversation.