php - How to Pass value to Bootstrap model in laravel? -
i trying pass value bootstrap model, each of rows edit button displays last row id. how can display edit button on each of rows?
here sample of code:
@foreach($data $cat_values) <tr> <td><input type="checkbox" class="checkthis" /></td> <td>{{$cat_values->cat_name}}</td> <td>{{$cat_values->cat_desc}}</td> <td>{{$cat_values->cat_slug}}</td> <td>{{$cat_values->created_at}}</td> <td>{{$cat_values->updated_at}}</td> <td><p data-id="{{$cat_values->id}}" data-placement="top" data-toggle="tooltip" title="edit"> <button data-id="{{$cat_values->id}}" class="btn btn-primary btn-xs edit-page" data-title="edit" data-toggle="modal" data-target="#edit" > <span class="glyphicon glyphicon-pencil"></span></button></p></td> <td><p data-id="{{$cat_values->id}}" data-placement="top" data-toggle="tooltip" title="delete"><button class="btn btn-danger btn-xs edit-page" data-title="delete" data-toggle="modal" data-target="#delete" ><span class="glyphicon glyphicon-trash"></span></button></p></td> <td><p data-placement="top" data-toggle="tooltip" title="delete"><button class="btn btn-danger btn-xs" data-title="delete" data-toggle="modal" data-target="#delete" ><span class="glyphicon glyphicon-trash"></span></button></p></td> </tr> @endforeach;
and here model:
<div class="modal fade" id="edit" tabindex="-1" role="dialog" aria-labelledby="edit" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> </button> <h4 class="modal-title custom_align" id="heading">edit detail</h4> </div> <div class="modal-body"> <div class="form-group"> <input type="text" id="id" name="id" value="" /> <input class="form-control " type="text" placeholder="" value="{{$cat_values->cat_name}}"> </div> <div class="form-group"> <input class="form-control " type="text" placeholder="" value="{{$cat_values->parent_cat}}"> </div> <div class="form-group"> <textarea rows="2" class="form-control" placeholder="" value="">{{$cat_values->parent_cat}}</textarea> </div> <div class="form-group"> <input class="form-control " type="text" placeholder="" value="{{$cat_values->cat_desc}}"> </div> <div class="form-group"> <input class="form-control " type="text" placeholder="" value="{{$cat_values->cat_slug}}"> </div> </div> <div class="modal-footer "> <button type="button" class="btn btn-warning btn-lg" style="width: 100%;"><span class="glyphicon glyphicon-ok-sign"></span> update</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div>
how can pass value bootstrap model in laravel? thank you.
updated:
public function viewcategory() { $retrive=category::all(); $data=['data'=>$retrive]; return view('a.view_category',$data); }
and in view if print data
@foreach($data $value) {{$value->id;}} {{$value->cat_name}} {{$value->cat_desc}} {{$value->cat_slug}} @endforeach
Comments
Post a Comment