Support the ongoing development of Laravel.io →
posted 7 years ago
Laravel

Hello everyone ... I have this problem, it is complicated to explain so I will try to summarize the easiest to help me,

First in my db I have a field in which I concatenate several numbers, the db adp:

ID - Id_fijacion - nr

1  - 1           -  4|5|5|7|....|n-1|n

What I am trying to do is to join 3 db, but dividing the chain concatnada(nr: 4|5|5|7|....|n-1|n)

This will do it already.

Controll:

    $Metrop  = DB::table('fijacion')->where('tipo','Metro')->join('adp', 'fijacion.id', '=', "adp.id_fijacion")->get();

    foreach($Metrop as $Metro){
        $array = explode("|", $Metro->nr);
        $Metro = DB::table('fijacion')->where('tipo','Metro')->join('adp', 'fijacion.id', '=', "adp.id_fijacion")->get();
        $MetroA[] = DB::table('users')
                  ->select('*')
                  ->whereIn('numero',$array)
                  ->where('categoria', '<=', 3)
                  ->join('puntos', 'users.numero', '=', "puntos.nr")
                  ->orderby('categoria', 'asc')
                  ->orderby('total', 'asc')
                  ->get();
     }

return view('UJOBBPanel.Designaciones.index',compact('Metro', 'MetroA'));

View:

@foreach($Metro as $Metro)

<tr>
<th>{{$Metro->dia}}</th>
<th>{{$Metro->fecha}}</th>
<th>{{$Metro->categoria}}</th>
<th>{{$Metro->hora}}</th>
<th>{{$Metro->cancha}}</th>
<th>{{$Metro->partido}}</th>
<th>@php$array = explode("|", $Metro->nr);$pepe = count($array);@endphp{{ $pepe }}</th>
<th>
<select class="form-control" name="select1" id="arbitro_1">
<option selected="true" disabled="disabled">Selecione 1º Arbitro</option>
<option disabled="disabled">---Internacional---</option>		
@foreach($MetroA as $MetroA)
<option value="{{$MetroA->numero}}">{{$MetroA->nombre}}. {{$MetroA->apellido}}</option>
@endforeach
</select>
</th>
@endforeach
</tr>
@endforeach

And I had the following error:

Property [numero] does not exist on this collection instance.

And this with the 3 variables, can someone give me a hand?

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

alexm alexm alexmeteora Joined 8 Aug 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.