samedi 1 octobre 2016

How to show value in if statement in laravel

I am doing my project but got stuck in this. I want to print both value of degrees and experiences. How can i achieve this? My controller file is like below:

public function industryPost (Request $request) {
        $industry = $request->input('industry');

        if (empty($industry)) {
            return 'Industry can not be null';
        } else {

            $experiences = AreaOfExperience::where('industry_id', $industry)->where('is_active', 1)->where('is_deleted', 0)->get();
            $degrees = Degree::where('industry_id', $industry)->where('is_active', 1)->where('is_deleted', 0)->get();


            if (!empty($degrees) ) {
                $string2 = '';
                foreach ($degrees as $degree) {
                    $string2 .= '
                        <div class="col-md-4">
                            <div class="be-checkbox">
                                <label class="check-box">
                                    <input id="degree" type="checkbox" name="degrees[]" value="'.$degree->id.'" class="checkbox-input">
                                    <span class="check-box-sign"></span>
                                </label>
                                <span class="large-popup-text"> '.$degree->name.' </span>
                            </div>
                        </div>
                    ';
                }
                return response($string2);
            }
            if (count($degrees) == 0) {
                return 101;
            }

            if (!empty($experiences) ) {
                $string = '';
                foreach ($experiences as $experience) {
                    $string .= '
                        <div class="col-md-4">
                            <div class="be-checkbox">
                                <label class="check-box">
                                    <input id="experience" type="checkbox" name="area_of_experiences[]" value="'.$experience->id.'" class="checkbox-input">
                                    <span class="check-box-sign"></span>
                                </label>
                                <span class="large-popup-text"> '.$experience->name.' </span>
                            </div>
                        </div>
                    ';
                }
                return response($string);
            }
            if (count($experiences) == 0) {
                return 100;
            }


        }
    }

I want to print both the value of degree and experience. But in my query it prints the value of degree. how can i achieve this? Please help!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire