/** * Remove the specified Container from storage. * * @param int $id * * @return Response */ public function destroy($id) { $container = $this->containerRepository->find($id); if (empty($container)) { Flash::error('Container not found'); return redirect(route('containers.index')); } $this->containerRepository->delete($id); Flash::success('Container deleted successfully.'); return redirect(route('containers.index')); }
/** * Show the form for editing the specified File. * * @param int $id * * @return Response */ public function edit($id) { $file = $this->fileRepository->find($id); if (empty($file)) { Flash::error('File not found'); return redirect(route('files.index')); } $file->name = $file->content->name; $file->identifier = $file->content->identifier; $file->description = $file->content->description; $file->container_id = $file->content->container_id; $datas = $this->containerRepository->all(); $containers = array(); foreach ($datas as $data) { if ($data->content) { $containers[$data->content->id] = $data->content->identifier; } } return view('files.edit', compact('containers'))->with('file', $file); }