mardi 15 décembre 2020

re-populating or retrieve from database checkbox array in Blade template

here is controller

public function edit_pay($id){

        $where = array('id' => $id);
        $arr =[];
        $users  = PaymentMethod::where($where)->first();
        $checked_arr = explode(" ",$users->purpose_of_used);
        return view('payment_method.edit_pay')->with(compact('users','checked_arr'));
      }
 <td> 

 <label><input type="checkbox" name="method[]" value=>Purchase</label><br>

 <label><input type="checkbox" name="method[]" value=> Gift Card</label><br>

 <label><input type="checkbox" name="method[]" value=> Sell</label><br>

 <label><input type="checkbox" name="method[]" value=> Expense</label></br>

 <label><input type="checkbox" name="method[]" value=> Loan</label><br>

 <label><input type="checkbox" name="method[]" value=> Exchange</label>



Aucun commentaire:

Enregistrer un commentaire