lundi 2 mars 2020

How to retrieve and show a boolean value in Laravel 6 form?

Booking.php model:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Booking extends Model
{
  public function setWifiAttribute($value)
  {
     return " $this->attributes['wifi'] = ($value=='on')?($value=1):($value=0)";
  }
}

In the form the part I want to show checkbox with the code as follows, which is sure needs some correction:

<div class="field">
  <label for="wifi" class="label">Wi-Fi</label>
      <div class="control">
         <input type="checkbox" class="form-check" name="wifi" id="wifi" value="">
      </div>
</div>

How should I refactor this part in the form?

value="">



Aucun commentaire:

Enregistrer un commentaire