Kanchan186
1 week ago

SQLSTATE[42S22]: Column not found: 1054 Unknown column ' departments.department_id' in 'on clause' (SQL: select * from `empzone_mappings` inner join `departments` on `empzone_mappings`.`department_id` = ` departments`.`department_id` inner join `designati

Posted 1 week ago by Kanchan186

empzoneControlller.php

public function show()
  {
    $empzonemapping=EmpzoneMapping::join('departments','empzone_mappings.department_id','=','                              departments.department_id')
                                  ->join('designations','empzone_mappings.designation_id','=','designations.designation_id')
                                  ->join('employees','empzone_mappings.emp_id','=','employees.emp_id')
                                  ->join('zones','empzone_mappings.zone_id','=','zones.zone_id')
                                  ->get();

    $department=Department::get();
    $designation=designation::get();
    $zone=Zone::get();
    $employee=Employee::get();
    $empzonemapping=EmpzoneMapping::get();
    
    //return $names;

   return view('backend.employee_zone_mapping.viewempzone',compact('empzonemapping','employee','department','designation','zone'));
  }

viewempzone.blade.php

 <div class="table-responsive m-t-40">
                                    <table id="example23" class="display nowrap table table-hover table-striped table-bordered" cellspacing="0" width="100%">
                                        <thead>
                                            <tr>
                                               <th>Sr No</th>
                                                 <th>department</th>            <th>designation </th>
                                                 <th>Employee Name</th>
                                                 <th>Zone</th>
                                                <th>Operations</th>
                                            </tr>
                                        </thead>
                                        
                                        <tbody>

                                          <?php $i=1; ?>
                                          @foreach($empzonemapping as $br)

                                            <tr>
                                            <td>{{$i++}}</td>
                                            <td>{{$br->department_name}}</td>
                                            <td>{{$br->designation_name}}</td>
                                            <td>{{$br->emp_fname}} {{$br->emp_lname}}</td>
                                            <td>{{$br->zone_name}}</td>   

                                                <td>
                                                  <a href="{{url('/')}}/employee_zone_mapping/{{$br->empzone_id}}/edit"><i class="fas fa-edit"></i></a> 

                                                  &nbsp;<a href="{{url('/')}}/employee_zone_mapping/{{$br->empzone_id}}" onclick="return confirm('Do you want delete this record')"><i class="fas fa-trash" ></i>
                                                </td>
                                            </tr>

                                           @endforeach
                                            
                                        </tbody>
                                    </table>
                                </div>

Please sign in or create an account to participate in this conversation.