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

153
Views
how to checked input checkbox datatable laravel?

i want to make a statement if is_participant is one then check the box, but i tried but it doesn't work

$user = User::with('regency.province');
        return DataTables::of($user)
            ->editColumn('is_participant', function ($user) {
                return '<input ' . $user->is_participant == 1 ? "checked" : "" . ' type="checkbox" id="' . $user->id . '">';
            })

is there something missing in my code

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try to apply the below code. I have tried to change quote formatting just the way PHP accepts.

->editColumn("is_participant", function ($user) {
         $checked = ($user-> is_participant == 1) ? 'checked' : '';
         return ' <input type="checkbox" id="' . $user->id . '" ' . $checked . '> ';
  });
about 4 years ago · Juan Pablo Isaza Report
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!