@@ 262-268 (lines=7) @@ | ||
259 | ||
260 | array_set($current_user, 'label', $current_user->name); |
|
261 | ||
262 | if (Auth::User()->hasRole(['superadministrator']) || $program_keahlian->user_id == $this->user_id) { |
|
263 | $error = false; |
|
264 | $message = 'Loaded.'; |
|
265 | } else { |
|
266 | $error = true; |
|
267 | $message = 'The data can not be loaded because it is not yours.'; |
|
268 | } |
|
269 | ||
270 | $response['program_keahlian'] = $program_keahlian; |
|
271 | $response['users'] = $users; |
|
@@ 311-319 (lines=9) @@ | ||
308 | $program_keahlian->user_id = $this->user_id; |
|
309 | } |
|
310 | ||
311 | if (Auth::User()->hasRole(['superadministrator']) || $program_keahlian->user_id == $this->user_id) { |
|
312 | $program_keahlian->save(); |
|
313 | ||
314 | $error = false; |
|
315 | $message = 'Success.'; |
|
316 | } else { |
|
317 | $error = true; |
|
318 | $message = 'The data can not be updated because it is not yours.'; |
|
319 | } |
|
320 | } |
|
321 | ||
322 | $response['error'] = $error; |