Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
Laravel Eloquent seleccione donde lo último sea igual al valor

Tengo dos tablas MySQL, la segunda tabla registró los estados de un atributo de la primera tabla, necesito obtener todos los registros de la primera tabla donde el último estado del atributo es igual al valor, ¿cómo hacerlo con elocuente?

aquí está mi código al que necesito agregar la condición:

 //Materiels table1 //Journal_etat_materiels table2 function getMaterielForAff(Request $request) { $data = Materiel::join('Types', 'Materiels.type_id', '=', 'Types.type_id') ->join('Users', 'Materiels.user_id', '=', 'Users.id') ->join('Journal_etat_materiels', 'Materiels.mat_code', '=', 'Journal_etat_materiels.mat_code') ->select( 'Materiels.id', 'Materiels.mat_code', 'Materiels.mat_designation', 'Materiels.mat_ns', 'Materiels.imei1', 'Materiels.imei2', 'Types.type_designation', 'Materiels.mat_description', 'Materiels.mat_carac', 'Materiels.note', 'Users.username', 'Materiels.mat_date' ) ->whereNotIn('Materiels.mat_code', explode(' ', $request->mat_codes)); return DataTables::of($data) ->addColumn('check', function ($check) { return '<input type="checkbox" required="required" name="check" class="check" id="' . $check->id . ' value="' . $check->id . '">'; }) ->rawColumns(['check']) ->make(true); }
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!