• 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
چاپ رکورد های تکراری در حلقه لاراول
#1
سلام.
دوستان من یه حلقه توو لاراول دارم که از 2 جدول اطلاعاتو میگیره.

جدول اولی لیست امکانات رو نشون میده و جدول دومی میاد موارد انتخاب شده رو توو خودش نگهداری میکنه

کد پی‌اچ‌پی:
$myoptions DB::table('real_estate_options')->
        
where('real_estate_options.active_or_die_''='1)->
        
where('real_estate_options.cat_selected''='1)->
        
orwhere('real_estate_options.cat_selected''='0)->
        
groupby('real_estate_options.ido')->
        
get();

        foreach(
$myoptions as $myopt){
            
        
$myoptionselected DB::table('real_estate_options_selected')->
            
join('real_estate_options','real_estate_options_selected.id_parent','=','real_estate_options.ido')->
        
groupby('real_estate_options.ido')->
        
get();
        foreach(
$myoptionselected as $myopts){
            if(
$myopt->ido==$myopts->id_parent){
                
$myc='checked';
            }else{
               
$myc=''
            }
        
                            
?>
                                <a class="media media-single">
                                 <span class="title">{!! $myopt->option !!}</span>
                                 <input type="checkbox" class="check" name="check[]" id="check{!! $myopt->ido !!}" {!! $myc !!} value="{!! $myopt->ido !!}">
                                    <label for="check{!! $myopt->ido !!}"></label>
                                </a>
                                <?php
        
}
        } 
اطلاعات چاپ شده ای که برام اکو میکنه موارد تکراری داره
کد پی‌اچ‌پی:
<class="media media-single">
                                 <
span class="title">آب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check1" checked value="1">
                                    <
label for="check1"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check1"  value="1">
                                    <
label for="check1"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check1"  value="1">
                                    <
label for="check1"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check1"  value="1">
                                    <
label for="check1"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check1"  value="1">
                                    <
label for="check1"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check1"  value="1">
                                    <
label for="check1"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check1"  value="1">
                                    <
label for="check1"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check1"  value="1">
                                    <
label for="check1"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">برق</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check2"  value="2">
                                    <
label for="check2"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">برق</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check2" checked value="2">
                                    <
label for="check2"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">برق</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check2"  value="2">
                                    <
label for="check2"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">برق</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check2"  value="2">
                                    <
label for="check2"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">برق</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check2"  value="2">
                                    <
label for="check2"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">برق</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check2"  value="2">
                                    <
label for="check2"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">برق</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check2"  value="2">
                                    <
label for="check2"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">برق</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check2"  value="2">
                                    <
label for="check2"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">گاز</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check3"  value="3">
                                    <
label for="check3"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">گاز</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check3"  value="3">
                                    <
label for="check3"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">گاز</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check3" checked value="3">
                                    <
label for="check3"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">گاز</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check3"  value="3">
                                    <
label for="check3"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">گاز</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check3"  value="3">
                                    <
label for="check3"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">گاز</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check3"  value="3">
                                    <
label for="check3"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">گاز</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check3"  value="3">
                                    <
label for="check3"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">گاز</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check3"  value="3">
                                    <
label for="check3"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تلفن</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check4"  value="4">
                                    <
label for="check4"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تلفن</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check4"  value="4">
                                    <
label for="check4"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تلفن</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check4"  value="4">
                                    <
label for="check4"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تلفن</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check4" checked value="4">
                                    <
label for="check4"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تلفن</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check4"  value="4">
                                    <
label for="check4"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تلفن</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check4"  value="4">
                                    <
label for="check4"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تلفن</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check4"  value="4">
                                    <
label for="check4"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تلفن</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check4"  value="4">
                                    <
label for="check4"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">فاضلاب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check5"  value="5">
                                    <
label for="check5"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">فاضلاب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check5"  value="5">
                                    <
label for="check5"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">فاضلاب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check5"  value="5">
                                    <
label for="check5"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">فاضلاب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check5"  value="5">
                                    <
label for="check5"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">فاضلاب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check5" checked value="5">
                                    <
label for="check5"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">فاضلاب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check5"  value="5">
                                    <
label for="check5"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">فاضلاب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check5"  value="5">
                                    <
label for="check5"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">فاضلاب</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check5"  value="5">
                                    <
label for="check5"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">پارکینگ</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check7"  value="7">
                                    <
label for="check7"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">پارکینگ</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check7"  value="7">
                                    <
label for="check7"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">پارکینگ</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check7"  value="7">
                                    <
label for="check7"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">پارکینگ</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check7"  value="7">
                                    <
label for="check7"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">پارکینگ</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check7"  value="7">
                                    <
label for="check7"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">پارکینگ</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check7" checked value="7">
                                    <
label for="check7"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">پارکینگ</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check7"  value="7">
                                    <
label for="check7"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">پارکینگ</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check7"  value="7">
                                    <
label for="check7"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آسانسور</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check8"  value="8">
                                    <
label for="check8"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آسانسور</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check8"  value="8">
                                    <
label for="check8"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آسانسور</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check8"  value="8">
                                    <
label for="check8"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آسانسور</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check8"  value="8">
                                    <
label for="check8"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آسانسور</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check8"  value="8">
                                    <
label for="check8"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آسانسور</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check8"  value="8">
                                    <
label for="check8"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آسانسور</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check8"  value="8">
                                    <
label for="check8"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">آسانسور</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check8"  value="8">
                                    <
label for="check8"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">انباری</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check9"  value="9">
                                    <
label for="check9"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">انباری</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check9"  value="9">
                                    <
label for="check9"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">انباری</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check9"  value="9">
                                    <
label for="check9"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">انباری</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check9"  value="9">
                                    <
label for="check9"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">انباری</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check9"  value="9">
                                    <
label for="check9"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">انباری</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check9"  value="9">
                                    <
label for="check9"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">انباری</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check9" checked value="9">
                                    <
label for="check9"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">انباری</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check9"  value="9">
                                    <
label for="check9"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تراس</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check10"  value="10">
                                    <
label for="check10"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تراس</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check10"  value="10">
                                    <
label for="check10"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تراس</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check10"  value="10">
                                    <
label for="check10"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تراس</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check10"  value="10">
                                    <
label for="check10"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تراس</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check10"  value="10">
                                    <
label for="check10"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تراس</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check10"  value="10">
                                    <
label for="check10"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تراس</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check10"  value="10">
                                    <
label for="check10"></label>
                                </
a>
                                                                <
class="media media-single">
                                 <
span class="title">تراس</span>
                                 <
input type="checkbox" class="check" name="check[]" id="check10" checked value="10">
                                    <
label for="check10"></label>
                                </
a
  پاسخ
تشکر شده توسط :


پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان