public function selectIn() { if (Auth::check()) { $id = $_GET['connection_name']; $any = $_GET['path']; $cname = 'all'; $proObj = new Provider($id); $data = $proObj->getFiles($any); // dummy check $dummy_tk = Token::where('connection_name', $id)->where('user_id', Auth::user()->id)->firstOrFail(); $dummy_files = DummyFile::where('dummy_store', $dummy_tk->id)->where('dummy_path', $any)->get(); if (!empty($dummy_files)) { foreach ($dummy_files as $d) { $real_tk = Token::where('id', $d->real_store)->where('user_id', Auth::user()->id)->firstOrFail(); $realProObj = new Provider($real_tk->connection_name); $temp = $realProObj->getFiles($d->path); $data = array_merge($data, $temp); } } if (!empty($data)) { foreach ($data as $key => $row) { $is_dir[$key] = $row['is_dir']; $name[$key] = $row['name']; } array_multisort($is_dir, SORT_DESC, $name, SORT_ASC, $data); } $parent = $this->getNavbar($cname, $proObj->getPathName($any), $any); return view('pages.gtl.components.gtl-board', ['data' => $data, "cname" => $cname, 'parent' => $parent, 'in' => $id]); } else { return Redirect::to('/'); } }
public function upload_dummy() { dump($_POST['real_store']); dump($_POST['dummy_path']); dump($_POST['dummy_store']); dump(User::find(Auth::user()->id)->token->where('connection_name', $_POST['real_store'])->first()->id); $tk = Token::where('connection_name', $_POST['real_store'])->where('user_id', Auth::user()->id)->firstOrFail(); $des = $tk->gtc_folder; if ($_POST['dummy_path'] == "") { $des = ""; } $proObj = new Provider($_POST['real_store']); $path = $proObj->uploadFile($_FILES['file'], $des); if ($_POST['dummy_store'] != 'all') { $dm = new DummyFile(); $real_store = User::find(Auth::user()->id)->token->where('connection_name', $_POST['real_store'])->first()->id; $dummy_store = User::find(Auth::user()->id)->token->where('connection_name', $_POST['dummy_store'])->first()->id; $dm->path = $path[0]['path']; $dm->real_store = $real_store; $dm->dummy_path = $_POST['dummy_path']; $dm->dummy_store = $dummy_store; $dm->save(); } return 'true'; }