在laravel 5.3中创建它的类和对象

时间:2016-12-16 06:41:24

标签: php class object view laravel-5.3

我正在为我的项目使用laravel 5.3。我有一个面板引导程序,其中有一些推车。每个购物车都有一些功能。我想定义一个购物车类,并使用jquery用按钮创建它的新对象。 我是laravel的新人。 我发现,我可以使用@include在我的代码中使用购物车,但我无法更改参数。 我怎样才能做到这一点? Main.blade.php:

 <div class="col-md-6">
      <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#AddGorohkary">add</button>
            </div>


        <div class="row" >
            <div class="col-md-12" >
                <ul class="horizontal-slide" dir="ltr" >

                    @include("Panel")

                </ul>
            </div>
        </div><!--  row -->

Panel.blade.php:

<li class="col-md-3" >
    <div  class="panel panel-primary" >
        <div class="panel-heading">

            <div class="row">

                <div data-toggle="tooltip" data-placement="bottom" title="حذف این گروه کاری"  class="col-md-1 col-sm-1 col-xs-1 col-lg-1  col-md-offset-1">
                    <button  onclick=" remove_entry($(this).parent().parent().parent().parent());" style="color: black;" type="button" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                </div>

                <div data-toggle="tooltip" data-placement="bottom" title="تنظیمات"  class="col-md-1 col-sm-1 col-xs-1 col-lg-1">
                    <span  data-toggle="modal"  data-target="#SettingModal" dir="rtl" style="color: black;" class="  glyphicon glyphicon-cog " aria-hidden="false"></span>
                </div>


                <div data-toggle="tooltip" data-placement="bottom" title="باز کردن صفحه گروه کاری"  class="col-md-1 col-sm-1 col-xs-1 col-lg-1">
                    <a style="color: black;" href='/SpecialGoruhKary'><span class='glyphicon glyphicon-export' aria-hidden="false"></span></a>
                </div>

                <div data-toggle="tooltip" data-placement="bottom" title="اضافه کردن دانش آموز جدید" class="col-md-1 col-sm-1 col-xs-1 col-lg-1">
                    <span   style="color: green;" class="glyphicon glyphicon-plus" aria-hidden="false"></span>
                </div>

                <div class="col-md-5 col-sm-5 col-xs-5 col-lg-5">
                    <span>@yield("GorohKarbariName")</span>
                </div>

            </div>

        </div>

        <div class="panel-body" style=" overflow-y: scroll;" >
            @yield("table_body")
        </div>

    </div>
</li>



<!---------------------------------- Modal ---------------------------------------------------->
<div id="SettingModal" class="modal fade" role="dialog">
    <div class="modal-dialog modal-lg">

        <!-- Modal content-->
        <div class="modal-content">
            <div dir="rtl" class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title ">مشخصات این گروه کاری</h4>
            </div>
            <div class="modal-body">

                <form  dir="rtl" class="form-horizontal" action="{{ url('image-upload') }}" enctype="multipart/form-data" method="post"  id="viewGorohkaryForm" >
                    {{ csrf_field() }}

                            <!-- Text input-->
                    <div  class="form-group">
                        <div class="col-md-5 col-md-offset-3  inputGroupContainer">
                            <div  dir="ltr" class="input-group">
                                <input dir="rtl" id="GorohKaryName"  name="GorohKaryName" placeholder="اسم گروه کاری" class="form-control"  type="text">
                                <span class="input-group-addon"><i class="glyphicon glyphicon-tag"></i></span>
                            </div>
                        </div>
                        <label for="GorohKaryName" class="col-md-2 control-label">اسم گروه کاری  <span style="color: red">*</span>     </label>
                    </div>

                    <!-- Text input-->
                    <div class="row col-md-offset-3">

                        <div  class="form-group col-md-3">
                            <div class=" inputGroupContainer">

                                <div class=" clockpicker" data-placement="left" data-align="top" data-autoclose="true">
                                    <div dir="ltr" class="input-group">
                                        <input id="ValidTime" type="text" class="form-control" value="08:00">
                                            <span class="input-group-addon">
                                               <span class="glyphicon glyphicon-time"></span>
                                            </span>
                                    </div>

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




                        <div  class="form-group col-md-4 ">
                            <div class=" inputGroupContainer">
                                <div dir="ltr" class="input-group col-md-offset-1">

                                    <select   style="direction: rtl;" class="form-control" id="day" name="day" required="required">
                                        <option   value="" data-hidden="true">روز هفته</option>
                                        <option value="0">شنبه</option>
                                        <option value="1">یکشنبه</option>
                                        <option value="2">دوشنبه</option>
                                        <option value="3">سه شنبه</option>
                                        <option value="4">چهارشنبه</option>
                                        <option value="5">پنجشنبه</option>
                                        <option value="6">جمعه</option>
                                    </select>

                                            <span class="input-group-addon">
                                                <span class="glyphicon glyphicon-calendar"></span>
                                             </span>
                                </div>
                            </div>
                        </div>

                        <div  class="form-group col-md-2">
                            <div class=" inputGroupContainer">
                                <div dir="ltr" class="input-group">

                                    <button type="button" class="btn btn-info btn-sm">
                                        <span class="glyphicon glyphicon-plus"></span>
                                    </button>
                                </div>
                            </div>
                        </div>

                        <label for="ValidTime" class="col-md-2 control-label" >زمان معتبر<span style="color: red">*</span>     </label>
                    </div><!-- row clock-->

                </form>

            </div><!---modal body--->
            <div class="modal-footer">
                <button id="CreateNewGorohkary" type="submit" class="btn btn-warning" data-dismiss="modal">ذخیره <span class="glyphicon glyphicon-save"></span></button>
            </div>


        </div><!-- modal content-->
    </div>
</div>

1 个答案:

答案 0 :(得分:1)

您可以使用this link包含子视图部分。 在该链接中,您可以看到如何将参数发送到包含页面。