/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $data = array('databanned' => table_banned_report::where('banned_report_id', '=', $id)->get(), 'users_detail' => json_encode(DB::select('select users_id as id, users_name as value, users_name as label from table_users_detail')), 'content' => json_encode(DB::select('select content_id as id, content_title as value, content_title as label from table_content'))); foreach ($data['databanned'] as $key => $value) { $userBy = $value->users_by; $userDest = $value->users_dest; $contentId = $value->content_id; } //Ambil data $users_name = DB::table('table_users_detail')->select('users_id as id', 'users_name as value', 'users_name as label')->where('users_id', '=', $userBy)->first(); $users_name2 = DB::table('table_users_detail')->select('users_id as id', 'users_name as value', 'users_name as label')->where('users_id', '=', $userDest)->first(); $content_id = DB::table('table_content')->select('content_id as id', 'content_title as value', 'content_title as label')->where('content_id', '=', $contentId)->first(); if ($users_name != null) { $data['dataUsers'] = $users_name; } else { $data['dataUsers'] = ''; } if ($users_name2 != null) { $data['dataUsers2'] = $users_name2; } else { $data['dataUsers2'] = ''; } if ($content_id != null) { $data['contentId'] = $content_id; } else { $data['contentId'] = ''; } //END Ambil data return view('admin.database.banned-report.banned-report-edit', compact('data')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $data = array('databanned' => table_banned_report::where('banned_report_id', '=', $id)->get()); return view('admin.database.banned-report.banned-report-edit', compact('data')); }