Prachee
3 months ago
268
1
Laravel

Error Class 'App\Http\Controllers\Auth' not found http://localhost/Laravel/public/delete-post/4

Posted 3 months ago by Prachee

Laravel Version 7.20 Function in PostController.

public function getDeletePost($post_id) { $post = Post::where('id', $post_id)->first(); if(Auth::user() != $post->user){ return redirect()->back(); } $post->delete(); return redirect()->route('dashboard')->with(['message' => 'Successfully Deleted!']); }

Please sign in or create an account to participate in this conversation.