예제 #1
0
 public function delete($id)
 {
     $item = Story::findOrFail($id);
     $item->delete();
     return redirect('/category/stories');
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
 /**
  * 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('/');
     }
 }