Forum

multiple databes data show or table show in a pages

My controller :

{
 $data = array(
      'employeedetails' => EmployInfo::all(),
      'designation' => Designation::all()
    );

    return view('employee.employeedetails', ['allEmployeeDeatails' => $data]);
  }

so how can i recived data in index.blade.php pages

data come by

array:2 [▼
  "employeedetails" => Collection {#258 ▼
    #items: array:10 [▼
      0 => EmployInfo {#259 ▶}
      1 => EmployInfo {#260 ▶}
      2 => EmployInfo {#261 ▶}
      3 => EmployInfo {#262 ▶}
      4 => EmployInfo {#263 ▶}
      5 => EmployInfo {#264 ▶}
      6 => EmployInfo {#265 ▶}
      7 => EmployInfo {#266 ▶}
      8 => EmployInfo {#267 ▶}
      9 => EmployInfo {#268 ▶}
    ]
  }
  "designation" => Collection {#250 ▼
    #items: array:6 [▼
      0 => Designation {#249 ▶}
      1 => Designation {#248 ▶}
      2 => Designation {#247 ▶}
      3 => Designation {#269 ▶}
      4 => Designation {#270 ▶}
      5 => Designation {#271 ▶}
    ]
  }
]

I am able to send data of both table which name are EmployInfo and Designation . But How can make view my pages on by on table data by index call.

What I was try ...

 <select class="form-control m-b" name="designation_id" id="designation_id">
         @foreach($allEmployeeDeatails as $designation)                  
             @foreach($designation['employeedetails']['id'] as $ki)
                 <option value="1">{{ $ki['employeedetails']['0']['id']}}</option>
               @endforeach
         @endforeach
   </select>
ashikjs
ashikjs
  • 1 week ago
ashikjs
Solution

I got this solution form live chat with #sisive_ Thanks a lot you.

@foreach($allEmployeeDeatails['designation'] as $designation)
          <option value="1">{{ $designation->name }}</option>             
  @endforeach