Update SiteController

This commit is contained in:
Daniel Supernault 2019-12-04 20:24:27 -07:00
parent ad8fc77e6c
commit d9ff794932
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -7,6 +7,7 @@ use App, Auth, Cache, View;
use App\Util\Lexer\PrettyNumber; use App\Util\Lexer\PrettyNumber;
use App\{Follower, Page, Profile, Status, User, UserFilter}; use App\{Follower, Page, Profile, Status, User, UserFilter};
use App\Util\Localization\Localization; use App\Util\Localization\Localization;
use App\Services\FollowerService;
class SiteController extends Controller class SiteController extends Controller
{ {
@ -98,4 +99,24 @@ class SiteController extends Controller
}); });
return View::make('site.terms')->with(compact('page'))->render(); return View::make('site.terms')->with(compact('page'))->render();
} }
public function redirectUrl(Request $request)
{
$this->validate($request, [
'url' => 'required|url'
]);
$url = urldecode(request()->input('url'));
return view('site.redirect', compact('url'));
}
public function followIntent(Request $request)
{
$this->validate($request, [
'user' => 'string|min:1|max:15|exists:users,username',
]);
$profile = Profile::whereUsername($request->input('user'))->firstOrFail();
$user = $request->user();
$following = $user != null ? FollowerService::follows($user->profile_id, $profile->id) : false;
return view('site.intents.follow', compact('profile', 'user', 'following'));
}
} }