diff options
Diffstat (limited to 'app/Http')
-rw-r--r-- | app/Http/Controllers/GalleryController.php | 6 | ||||
-rw-r--r-- | app/Http/Controllers/NewsController.php | 11 |
2 files changed, 10 insertions, 7 deletions
diff --git a/app/Http/Controllers/GalleryController.php b/app/Http/Controllers/GalleryController.php index 064be02..d2a04c5 100644 --- a/app/Http/Controllers/GalleryController.php +++ b/app/Http/Controllers/GalleryController.php @@ -8,6 +8,7 @@ use dd; use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Validator; +use Illuminate\Support\Facades\Storage; use App\Models\Image; @@ -102,7 +103,10 @@ class GalleryController extends Controller */ public function destroy($id) { - Image::findOrFail($id)->delete(); + $img = Image::findOrFail($id); + $path = $img->path . $img->name; + Storage::delete($path); + $img->delete(); return Redirect::back()->with('status', 'Image deleted.'); } } diff --git a/app/Http/Controllers/NewsController.php b/app/Http/Controllers/NewsController.php index de7a823..8be535e 100644 --- a/app/Http/Controllers/NewsController.php +++ b/app/Http/Controllers/NewsController.php @@ -34,9 +34,8 @@ class NewsController extends Controller */ public function create() { - // - $data = Post::orderBy('created_at', 'desc')->get(); - return view('pages.news-admin', compact('data')); + //$data = Post::orderBy('created_at', 'desc')->get(); + return view('pages.news-admin');//, compact('data')); } /** @@ -127,8 +126,8 @@ class NewsController extends Controller $post->text = $request->text; $post->saveOrFail(); - return Redirect::route('newsAdd')->with('statusE', "Post edited."); - } else return Redirect::route('newsAdd'); + return Redirect::route('news')->with('status', "Post edited."); + } else return Redirect::route('news'); } /** @@ -142,6 +141,6 @@ class NewsController extends Controller $post = Post::findOrFail($id); $title = $post->title; $post->delete(); - return Redirect::back()->with('statusE', "Post \"$title\" deleted."); + return Redirect::back()->with('status', "Post \"$title\" deleted."); } } |