add ability to redirect a link with query string

This commit is contained in:
aprillio 2021-07-06 17:19:09 +07:00
parent 4c3163674f
commit ab3471b428
1 changed files with 7 additions and 0 deletions

View File

@ -85,12 +85,19 @@ class UserController extends Controller
public function clickNumber(request $request)
{
$link = $request->link;
$query = $request->query();
$linkId = $request->id;
if(empty($link && $linkId))
{
return abort(404);
}
if(!empty($query)) {
$qs = '';
foreach($query as $qk => $qv) { $qs .= $qk .'='. $qv; }
$link = $link .'?'. $qs;
}
Link::where('id', $linkId)->increment('click_number', 1);