add ability to redirect a link with query string
This commit is contained in:
parent
4c3163674f
commit
ab3471b428
|
@ -85,12 +85,19 @@ class UserController extends Controller
|
||||||
public function clickNumber(request $request)
|
public function clickNumber(request $request)
|
||||||
{
|
{
|
||||||
$link = $request->link;
|
$link = $request->link;
|
||||||
|
$query = $request->query();
|
||||||
$linkId = $request->id;
|
$linkId = $request->id;
|
||||||
|
|
||||||
if(empty($link && $linkId))
|
if(empty($link && $linkId))
|
||||||
{
|
{
|
||||||
return abort(404);
|
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);
|
Link::where('id', $linkId)->increment('click_number', 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue