mercredi 26 avril 2017

Get column names to show and store in another table Error Undefined Index [duplicate]

In laravel 5.1 it is giving en error UNDEFINED INDEX::cost_group i want to show courses table's coulumn name by frop down in another payments view page and store it into another table(payments) when one of them is selected My PaymentsController.php

public function index(Request $request) {
        $filter = $request->input();
        $sort = $request->query();
        $payments = Payment::filter($filter)->sort($sort)->paginate(10);

        foreach(Course::all() as $course) {
            $data['courses'][$course->id] = $course->name;
            $data['courses'][$course->cost_group]=$course->course_cost;
            $data['courses'][$course->cost_minigroup]=$course->course_name;
            $data['courses'][$course->cost_individual]=$course->course_name;

        }

        return view('payments.index', compact('payments', 'data'));
    }

My form.blade.php (of payments)

<div class="ui form">
             <div class="field">
                 <div class="ui selection dropdown">
                     <input type="hidden" name="amount" id="course_val" />
                     <i class="dropdown icon"></i>
                     <div class="default text">Course type</div>
                     <div class="menu">
                         <div class="item course_val" data-value="">Group</div>
                         <div class="item course_val" data-value="">Minigroup</div>
                         <div class="item course_val" data-value="">Individual</div>
                     </div>
                 </div>
             </div>
         </div>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire