public function show($id) { $infoConfig = InfoConfig::first()->toArray(); $object = Model::find($id); if ($object) { return view('news', ['objects' => $object, 'type' => 'tenders', 'title' => LANG . '_title', 'description' => LANG . '_description', 'text' => LANG . '_text', 'requirements' => LANG . '_requirements', 'contacts' => LANG . '_contacts', 'infoConfig' => $infoConfig]); } return redirect(LANG . '/tenders'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $object = Model::find($id); if ($object) { $object->delete(); } return redirect()->back(); }
public function destroyFileKz($id) { $tender = Tender::find($id); if (!is_null($tender->file_kz)) { $file_path = $this->upload_dir_kz . '/' . $tender->file_kz; if (file_exists($file_path)) { unlink($file_path); $tender->file_kz = null; $tender->save(); } } return redirect()->route('edit', ['id' => $tender->id]); }