mercredi 6 juin 2018

Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: C:\xampp\htdocs\medipro55\resources\views\admin\division\index.blade.php)

i am try to update request data with jquery form i get only that error i found any solve but not. That is my view page. Edit button

<button type="button" class="btn btn-pill btn-outline-primary btn-sm open_model" data-toggle="modal" data-target="#editModal" data-id="{!! $d->id !!}"
                                                    data-description="{!! $d->description !!}"
                                                    data-sorting="{!! $d->sorting !!}">
                                            <i class="fa fa-pencil"></i> Edit
                                        </button>

(index.blade.php)

{!! Form::open(['url' => 'divisions/'.$divisions->id, 'method' => 'PUT', 'class' => 'form-horizontal']) !!}
<div class="form-group row">
    <label class="col-md-3 col-form-label" for="name">Division</label>
    <div class="col-md-9">
        <input type="text" id="description" name="description" value="" class="form-control" placeholder="Enter Division..">
        <input type="hidden" class="form-control" name="id" id="id">
        <span class="help-block"></span>
        @if ($errors->has('description'))
        <span class="text-danger"></span>
        @endif
    </div>
</div>
<div class="form-group row">
    <label class="col-md-3 col-form-label" for="sort">Sort</label>
    <div class="col-md-9">
        <input type="text" id="sorting" name="sorting" value="" class="form-control" placeholder="Enter Sort..">
        <span class="help-block"></span>
        @if ($errors->has('sorting'))
        <span class="text-danger"></span>
        @endif
    </div>
</div>
<div class="pull-right">
    <button type="submit" class="btn btn-pill btn-success btn-outline-success">
    Update</button>
    <button type="button" data-dismiss="modal" class="btn btn-pill btn-danger btn-outline-danger">
    Close</button>
</div>
{!! Form::close() !!}

that my jquery code for my edit popup model form

$( document ).ready(function() {
    $('#editModal').on('show.bs.modal', function (event) {
        var button = $(event.relatedTarget)
        var description = button.data('description')
        var sorting = button.data('sorting')
        var id = button.data('id')
        var modal = $(this)
        modal.find('.modal-body #description').val(description)
        modal.find('.modal-body #sorting').val(sorting)
        modal.find('.modal-body #id').val(id)
        // alert('id');
    });
});

DivisionController.php

public function index()
{
    $divisions = Division::paginate(10);
    return view('admin.division.index')->with('divisions', $divisions);
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire