Code Duplication    Length = 19-19 lines in 2 locations

src/Http/Controllers/AkademikController.php 1 location

@@ 84-102 (lines=19) @@
81
     *
82
     * @return \Illuminate\Http\Response
83
     */
84
    public function get()
85
    {
86
        $akademiks = $this->akademik->with(['siswa', 'user'])->get();
87
88
        foreach ($akademiks as $akademik) {
89
            if ($akademik->siswa !== null) {
90
                array_set($akademik, 'label', $akademik->siswa->nomor_un.' - '.$akademik->siswa->nama_siswa);
91
            } else {
92
                array_set($akademik, 'label', $akademik->nomor_un.' - ');
93
            }
94
        }
95
96
        $response['akademiks']  = $akademiks;
97
        $response['error']      = false;
98
        $response['message']    = 'Success';
99
        $response['status']     = true;
100
101
        return response()->json($response);
102
    }
103
104
    /**
105
     * Show the form for creating a new resource.

src/Http/Controllers/NilaiController.php 1 location

@@ 81-99 (lines=19) @@
78
     *
79
     * @return \Illuminate\Http\Response
80
     */
81
    public function get()
82
    {
83
        $nilais = $this->nilai->with(['siswa', 'user', 'nilaiakademik'])->get();
84
85
        foreach ($nilais as $nilai) {
86
            if ($nilai->siswa !== null) {
87
                array_set($nilai, 'label', $nilai->siswa->nomor_un.' - '.$nilai->siswa->nama_siswa);
88
            } else {
89
                array_set($nilai, 'label', $nilai->nomor_un.' - ');
90
            }
91
        }
92
93
        $response['nilais']     = $nilais;
94
        $response['error']      = false;
95
        $response['message']    = 'Success';
96
        $response['status']     = true;
97
98
        return response()->json($response);
99
    }
100
101
    /**
102
     * Show the form for creating a new resource.