首页 > 解决方案 > 如何在 Yajrabox 中添加显示数据按钮

问题描述

我正在与 Laravel 合作,我问如何添加一个按钮,将我发送到一个可以显示我的数据的页面,我已经完成了,但我不知道如何在 Yajrabox 表单中添加按钮我在谈论这个:

<td>
 <a  href="{{ url('sujet/'.$sujet->id.'/afficher') }}" class="btn btn-info"> See the informations  </a>
</td>

这是我的 Yajrabox 视图:

<html>
<head>
</head>
<body>
  <!-- Static navbar -->
  <nav class="navbar navbar-inverse">
    <div class="container-fluid">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
          <a class="navbar-brand" href="{{url('/accueil')}}"><span style="font-size:30px;font-family:'Cairo';color:silver">الغلبزوزي</span></a>
      </div>
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <ul class="nav navbar-nav">

          <li style="padding:5px"> <a href="{{url('archive')}}"> <strong style="font-size:15px;padding:5px">أرشيف</strong> &nbsp <span class="glyphicon glyphicon-folder-open pull-right"> </span> </a></li>

             <li style="padding:5px" > <a href="{{url('/client')}}"> <strong style="font-size:15px;padding:5px">  الموكلون </strong> &nbsp <span class="glyphicon glyphicon-user pull-right"> </span> </span></a></li>

             <li style="padding:5px"> <a href="{{url('sujet')}}"> <strong style="font-size:15px;padding:5px"> الملفات </strong> &nbsp<span class="glyphicon glyphicon-book pull-right"> </span></a></li>

             <li style="padding:5px"> <a href="{{url('session')}}"> <strong style="font-size:15px;padding:5px"> الجلسات </strong> &nbsp <span class="glyphicon glyphicon-home pull-right"> </span> </a></li>
             <li style="padding:5px"> <a href="{{url('facture')}}"> <strong style="font-size:15px;padding:5px">مصاريف</strong> &nbsp <span class="glyphicon glyphicon-euro pull-right"> </span> </a></li>

             <li style="padding:5px" ><a href="{{url('sujet/recherche')}}" > <strong style="font-size:15px;padding:5px"> بحث </strong> &nbsp<span class="glyphicon glyphicon-search pull-right"></span></a></li>





        </ul>
      </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
  </nav>
<div style="text-align: right" class=" container ">

  <img class="responsive" style="width:100%" src="{{asset('img/projet-elghalbzouri.jpg')}}" />
  <div class="row">
    <div class="col-md-12">


    <div class="table-responsive">
      <table  class="table border" border="1" id="myTable" >
        <thead>
        <tr>
          <th>رقم الملف بالمكتب</th>

          <th>الموضوع</th>
          <th>تاريخ فتح الملف</th>

        </tr>
      </thead>

      </table>

    </div>



    </div>
</div>
</div>

<script src="https://datatables.yajrabox.com/js/jquery.min.js"></script>
<script src="https://datatables.yajrabox.com/js/bootstrap.min.js"></script>
<script src="https://datatables.yajrabox.com/js/jquery.dataTables.min.js"></script>
<script src="https://datatables.yajrabox.com/js/datatables.bootstrap.js"></script>


<script type="text/javascript">
$(function() {
     $('#myTable').DataTable({
         processing: true,
         serverSide: true,
         ajax: '/sujet/data',


         columns: [
           {data: 'id'},
           {data: 'nomsujet'},
           {data: 'tarikhfathmilaf'},

       ]
     });
 });
</script>

</body>
</html>

此按钮将我发送到显示我的数据的视图,请问如何在 Yajrabox 中添加该视图?

标签: phplaravel

解决方案


你应该试试这个:

您的路线如下:

Route::get('sujet/{id}/afficher',"yourcontroller@yourfunction")->name('sujet.afficher');

<td>
 <a  href="{{ route('sujet.afficher', [$sujet->id]) }}" class="btn btn-info"> See the informations  </a>
</td>

推荐阅读