public function delete($id) { $item = Story::findOrFail($id); $item->delete(); return redirect('/category/stories'); }
/** * used to restore a story from trash * @param [type] $id [description] * @return [json] [description] */ public function restoreStory($id) { $story = Story::findOrFail($id); $story->update(['status' => 'draft']); $respons = ['success' => true]; return $respons; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $story = Story::findOrFail($id); if ($this->owner($id)) { $fileName = $story->photo; File::delete('images/' . $fileName); $story->delete(); flash()->info('Story removed!'); return redirect('/'); } else { flash()->error('You are not authorized!'); return redirect('/'); } }