sortDesc(); return view('admin.news.index', compact('news')); } public function create() { return view('admin.news.create'); } public function store(StoreNewsRequest $request) { $validated = $request->validated(); $urlPhoto = Storage::put('public', $request->file('photo')); $news = new News(); $news->name = $validated['name']; $news->text = $validated['text']; $news->photo = Storage::url($urlPhoto); $news->save(); return redirect()->route('news.index'); } public function show(News $news) { return view('admin.news.show', compact('news')); } public function edit(News $news) { return view('admin.news.edit', compact('news')); } public function update(UpdateNewsRequest $request, News $news) { $validated = $request->validated(); $news->name = $validated['name']; $news->text = $validated['text']; $news->save(); return redirect()->route('news.index'); } public function destroy(News $news) { $news->delete(); return redirect()->route('news.index'); } }