public function edit($id)
{
$post = POST::find($id);
// Check for correct user
if (auth()->user()->id !== $post->user_id) {
return redirect('/posts')->with('error', 'Unauthorized page');
}
return view('posts.edit')->with('post', $post);
}