26 lines
586 B
PHP
26 lines
586 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Fo;
|
||
|
|
|
||
|
|
use App\Http\Controllers\Controller;
|
||
|
|
use App\Jobs\IncrementUrlStat;
|
||
|
|
use App\Models\Url;
|
||
|
|
|
||
|
|
class UrlController extends Controller
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Redirect an url to its value.
|
||
|
|
*
|
||
|
|
* @param \App\Models\Url $url
|
||
|
|
*
|
||
|
|
* @return \Illuminate\Contracts\View\View
|
||
|
|
*/
|
||
|
|
public function redirect(Url $url)
|
||
|
|
{
|
||
|
|
IncrementUrlStat::dispatch($url)->onConnection('database')->onQueue('database');
|
||
|
|
|
||
|
|
return \redirect($url->value, 301)
|
||
|
|
->header('Cache-Control', 'no-store, no-cache, must-revalidate');
|
||
|
|
}
|
||
|
|
}
|