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
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 . '> ';
});