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

@@ 111-129 (lines=19) @@
108
     *
109
     * @return \Illuminate\Http\Response
110
     */
111
    public function get()
112
    {
113
        $nilais = $this->nilai->with(['siswa', 'user', 'nilai_akademik'])->get();
114
115
        foreach ($nilais as $nilai) {
116
            if ($nilai->siswa !== null) {
117
                array_set($nilai, 'label', $nilai->siswa->nomor_un.' - '.$nilai->siswa->nama_siswa);
118
            } else {
119
                array_set($nilai, 'label', $nilai->nomor_un.' - ');
120
            }
121
        }
122
123
        $response['nilais']     = $nilais;
124
        $response['error']      = false;
125
        $response['message']    = 'Success';
126
        $response['status']     = true;
127
128
        return response()->json($response);
129
    }
130
131
    /**
132
     * Show the form for creating a new resource.