@jlrdw
great guys thanks, this is what I did but have run into a simple problem, please read:
public function status(Request $request)
{
if($request->ajax()) {
$comment = Comment::where('id', $request->comment_id)->first();
$comments = Comment::latest()->paginate(3);
$comment->status = $request->status;
$comment->save();
return response()->json([
'status' => 'success',
'comment' => $comment,
'pagination' => view('core.comments.pagination', compact('comments'))->render(),
], 201);
}
}
my routes:
Route::get('/', ['as' => 'backend.comments.index', 'uses' => 'CommentController@index']);
Route::post('status', ['as' => 'backend.comments.status', 'uses' => 'CommentController@status']);
I have a problem now as you can see function status is called, and the problem is that pagination generated applys status in the url so the link ends up being
http://larapress.dev/backend/comments/status?page=2
instead of
http://larapress.dev/backend/comments?page=2
second one works and is generated corrctly when I first enter the page, but as soon as i update the status on the model and new pagination is sent back it has added status in the url and that fails as you can understand. Is there a way around this?