Loading app/Http/Controllers/ManageAdherentController.php +11 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace App\Http\Controllers; use App\Models\RoleAttribution; use App\Models\User; use Illuminate\Http\Request; Loading @@ -23,6 +24,16 @@ function index() { function update(Request $request) { @dd($request->all()); $uptUser = $request->all(); foreach ($uptUser as $key => $value) { if ($key != '_token') { $user = User::find($key); $key = $userRole = RoleAttribution::select('*')->where('US_ID', '=', $key)->get(); $user->ROL_CODE = $value; $user->save(); } } return redirect()->route('manage_members'); } Loading resources/views/manageAdherent.blade.php +4 −5 Original line number Diff line number Diff line Loading @@ -14,21 +14,20 @@ </tr> </thead> <tbody> @dump($users); @for ($i = 1; $i < count($users[0]); $i++) <tr class="odd:bg-white even:bg-gray-50 border-b"> <td class="px-6 py-4">{{ $users[0][$i][1] . " " . $users[0][$i][2] }}</td> <td class="px-6 py-4"> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox{{ $users[0][$i][0] }}" value="checkbox{{ $users[0][$i][0] }}_DIV" @if(array_search('DIV', $users[1][$i]) !== false) checked @endif> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox_{{ $users[0][$i][0] }}_DIV" value="DIV" @if(array_search('DIV', $users[1][$i]) !== false) checked @endif> </td> <td class="px-6 py-4"> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox{{ $users[0][$i][0] }}" value="checkbox{{ $users[0][$i][0] }}_SEC" @if(array_search('SEC', $users[1][$i]) !== false) checked @endif> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox_{{ $users[0][$i][0] }}_SEC" value="SEC" @if(array_search('SEC', $users[1][$i]) !== false) checked @endif> </td> <td class="px-6 py-4"> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox{{ $users[0][$i][0] }}" value="checkbox{{ $users[0][$i][0] }}_PIL" @if(array_search('PIL', $users[1][$i]) !== false) checked @endif> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox_{{ $users[0][$i][0] }}_PIL" value="PIL" @if(array_search('PIL', $users[1][$i]) !== false) checked @endif> </td> <td class="px-6 py-4"> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox{{ $users[0][$i][0] }}" value="checkbox{{ $users[0][$i][0] }}_DIR" @if(array_search('DIR', $users[1][$i]) !== false) checked @endif> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox_{{ $users[0][$i][0] }}_DIR" value="DIR" @if(array_search('DIR', $users[1][$i]) !== false) checked @endif> </td> </tr> @endfor Loading Loading
app/Http/Controllers/ManageAdherentController.php +11 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace App\Http\Controllers; use App\Models\RoleAttribution; use App\Models\User; use Illuminate\Http\Request; Loading @@ -23,6 +24,16 @@ function index() { function update(Request $request) { @dd($request->all()); $uptUser = $request->all(); foreach ($uptUser as $key => $value) { if ($key != '_token') { $user = User::find($key); $key = $userRole = RoleAttribution::select('*')->where('US_ID', '=', $key)->get(); $user->ROL_CODE = $value; $user->save(); } } return redirect()->route('manage_members'); } Loading
resources/views/manageAdherent.blade.php +4 −5 Original line number Diff line number Diff line Loading @@ -14,21 +14,20 @@ </tr> </thead> <tbody> @dump($users); @for ($i = 1; $i < count($users[0]); $i++) <tr class="odd:bg-white even:bg-gray-50 border-b"> <td class="px-6 py-4">{{ $users[0][$i][1] . " " . $users[0][$i][2] }}</td> <td class="px-6 py-4"> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox{{ $users[0][$i][0] }}" value="checkbox{{ $users[0][$i][0] }}_DIV" @if(array_search('DIV', $users[1][$i]) !== false) checked @endif> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox_{{ $users[0][$i][0] }}_DIV" value="DIV" @if(array_search('DIV', $users[1][$i]) !== false) checked @endif> </td> <td class="px-6 py-4"> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox{{ $users[0][$i][0] }}" value="checkbox{{ $users[0][$i][0] }}_SEC" @if(array_search('SEC', $users[1][$i]) !== false) checked @endif> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox_{{ $users[0][$i][0] }}_SEC" value="SEC" @if(array_search('SEC', $users[1][$i]) !== false) checked @endif> </td> <td class="px-6 py-4"> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox{{ $users[0][$i][0] }}" value="checkbox{{ $users[0][$i][0] }}_PIL" @if(array_search('PIL', $users[1][$i]) !== false) checked @endif> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox_{{ $users[0][$i][0] }}_PIL" value="PIL" @if(array_search('PIL', $users[1][$i]) !== false) checked @endif> </td> <td class="px-6 py-4"> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox{{ $users[0][$i][0] }}" value="checkbox{{ $users[0][$i][0] }}_DIR" @if(array_search('DIR', $users[1][$i]) !== false) checked @endif> <input type="checkbox" id="checkbox{{ $users[0][$i][0] }}" name="checkbox_{{ $users[0][$i][0] }}_DIR" value="DIR" @if(array_search('DIR', $users[1][$i]) !== false) checked @endif> </td> </tr> @endfor Loading