طريقة انى اندة فنكشن او اخليها تشتغل اوتماتيك اولما الصفحة تفتح الفنكشن حاططها فى الميثود

عايز اجيب بيانات من الداتا بيز عن طريق الفنكشن دية بتبعت ريكوست ل لارافل ويرد عليها بداتا فا فى الكرييت بندها عادى اما اغير الحقل فى الابديت عايزوة يج...

عايز اجيب بيانات من الداتا بيز عن طريق الفنكشن دية بتبعت ريكوست ل لارافل ويرد عليها بداتا فا فى الكرييت بندها عادى اما اغير الحقل فى الابديت عايزوة يجيبلى الداتا على طول عن طريق القيمة اللى مدهالوة لوفية طريقة افضل يا ريت توضحهالى انا دلوقتى عايز حقول الابديت يبقى فيها الداتا بتاعتها

// CODE VUE JS
<script>
        new Vue({
            el: \"#app\",
            data: {
                disable: false,
                year: {{$app->year}},
                hide: false,
                hid: false,
                planss: [],
                //get courses
                hidd: false,
                courses: [],
                brandCourse: \"\",
                ready: function () {
                    window.beforeunload = getdata;
            },
            methods: {
                getdata: function () {
                    if (this.year !== \"\") {
//                            alert(this.year)
                        this.hid = true
                        this.getPlan(this.year)
                    } else {
                        this.hid = false
                    }

                },
                getPlan: function (year) {
                    this.$http.get(\'/academy/public/plan/\' + year).then(
                            function (response) {
                                if (response.body.length > 0) {
                                    this.disable = true;
//                                        console.log(response.body);
                                    this.planss = response.body;
                                    this.disable = false;
                                } else {
                                    this.hid = false;
                                    this.planss = \"\";
                                }
                            },
                            function () {

                            });
                }, brandCourses: function () {
                    if (this.brandCourse !== \"\") {
//                            alert(this.brandCourse);
                        this.hidd = true;
                        this.getAllCourses(this.brandCourse);
                    } else {
                        this.hidd = false
                    }

//                        }
                },
                getAllCourses: function (brandCourse) {
                    this.$http.get(\'/academy/public/allcourses/\' + brandCourse).then(
                            function (response) {
                                if (response.body.length > 0) {
//                                        console.log(response.body);
                                    this.courses = response.body;
                                } else {
                                    this.hidd = false;
                                    this.courses = \"\";
                                }
                            },
                            function () {
                                this.hidd = false
                            });
                }
            }
        });
    </script>

////////// form 
{!! Form::model($app,[\'url\'=>\'/app_register/\'.$app->id ,\'method\'=>\'patch\',\'class\' => \'form-horizontal form-row-seperated\',\'files\' => true]) !!}

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">السنة</label>

                        <div class=\"col-md-9\">

                            <select v-model=\"year\" v-on:change=\"getdata\" v-bind:disabled=\"disable\" class=\"form-control\"
                                    data-placeholder=\"الدولة\" name=\"year\">

                                @foreach($plans as $plan)
                                    <option value=\"{{$plan->plan_year}}\">{{$plan->plan_year}}</option>
                                @endforeach
                            </select>
                        </div>

                    </div>
                    <br/>

                    <div class=\"form-group\">

                        <label class=\"control-label col-md-3\">plan</label>

                        <div class=\"col-md-9\">
                            <select v-show=\"hid\" id=\"brandCourse\" v-model=\"brandCourse\" v-on:change=\"brandCourses\"
                                    class=\"form-control\"
                                    name=\"plan_id\" data-placeholder=\"plan\">
                                {{--<select  class=\"form-control\" v-model=\"\"  >--}}

                                <option v-for=\"p in planss\" :value=\'p.plan_id\'>@{{ p.plan_name }}</option>

                            </select>
                        </div>

                    </div>
                    <br/>

                    <div class=\"form-group\">

                        <label class=\"control-label col-md-3\">courses</label>

                        <div class=\"col-md-9\">
                            <select v-show=\"hidd\" class=\"form-control\" name=\"course_id\" data-placeholder=\"plan\"
                                    name=\"course_id\">
                                {{--<select  class=\"form-control\" v-model=\"\"  >--}}
                                {{--<option value=\"\"></option>--}}
                                <option v-for=\"c in courses\"
                                        :value=\'c.plan_course_id\'>@{{ c.plan_course_country }}</option>

                            </select>
                        </div>

                    </div>
                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">تاريخ الانعقاد </label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'date_of_start\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">مكان الانعقاد </label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'place_of_start\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\"> الاسم بالعربية</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'name_ar\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\"> الاسم بالانجليزية</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'name_en\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\"> الوظيفة الحالية</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'current_job\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">حهة العمل</label>

                        <div class=\"col-md-9\">
                            <select class=\"form-control\" name=\"corprate_name\" data-placeholder=\"plan\">
                                {{--<select  class=\"form-control\" v-model=\"\"  >--}}

                                <option value=\"\"></option>
                                @foreach($corps as $corp)
                                    <option value=\"{{ $corp->corp_id }}\">{{ $corp->corp_name }}</option>
                                @endforeach
                            </select>

                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">عنوان العمل</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'address_work\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">الموبيل</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'mobile\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">رقم التليفون</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'tel_work\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">فاكس</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'fax\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">تاريخ الميلاد</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'birth_day\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">البريد الالكترونى</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'email\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">المسئول عن التدريب</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'responsability_of_training\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">العمل</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'job\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">هل سبق لك ان اشتركت ببرامج تدريبية فى الاكاديمية ضع () فى
                            المكان المناسب :</label>

                        <div class=\"col-md-9\">

                            {!! Form::radio(\'join\',\'0\') !!}
                            <br>
                            {!! Form::radio(\'join\',\'1\') !!}

                        </div>
                    </div>

                    <br/>

                    <div class=\"form-group\">
                        <label class=\"control-label col-md-3\">الرقم</label>

                        <div class=\"col-md-9\">
                            {!! Form::text(\'number_of_appliction\' ,null ,[\"class\"=>\"form-control\"]) !!}
                        </div>
                    </div>


                    <div style=\"text-align: center; margin-top: 40px\">


                        {!! Form::submit(\'تعديل\',[\"class\"=>\"btn btn-success\"]) !!}
                        {!! Form::close() !!}





//////// function laravel
public function getplan($year){
        return \\App\\Plan::where(\'plan_year\',$year)->get();
    }
    public function getallcourses($year){
        return \\App\\PlanCourse::where(\'plan_course_plan\',$year)->get();
    }

1 التعليقات


  • Abdel Aziz Hassan
    Abdel Aziz Hassan 2017-09-21 17:57:02

    اعمل array فيها متسجل فيها لمعومات الخطة اول ما تخش الصحفة و لما تعبت تعمل update
    الالرفيل كده كده بيرجعلك بالمعلومات بتاعت row اللي هو عملها update استقبلها ب vue وبعدين
    حطها في array اللي انت عاملها من قبل هتلاقي ساعتها البينات اللي في الحقول اتحط فيها المعلومات
    الجديدة اللي انت عدلتها مش القديمة
    تحياتي لك

اضف تعليق


يجب ان يكون لديك حساب في الموقع تسجيل الدخول او تسجيل عضوية جديدة

خدمات ويب الفريق