本文整理汇总了PHP中ujs_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP ujs_redirect函数的具体用法?PHP ujs_redirect怎么用?PHP ujs_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ujs_redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check() && $this->auth->user()->isBanned()) {
$this->auth->logout();
return ujs_redirect(route('users.disabled'));
}
return $next($request);
}
示例2: store
public function store(HttpRequest $request, $forum_id)
{
$this->validate($request, ['title' => 'required', 'body' => 'required']);
$forum = Forum::findOrFail($forum_id);
$this->authorizePost($forum, null);
$topic = Topic::createNew(['forum' => $forum, 'title' => $request->input('title'), 'poster' => Auth::user(), 'body' => $request->input('body'), 'notifyReplies' => false, 'cover' => TopicCover::findForUse(presence($request->input('cover_id')), Auth::user())]);
Event::fire(new TopicWasCreated($topic, $topic->posts->last(), Auth::user()));
return ujs_redirect(route('forum.topics.show', $topic));
}
示例3: store
public function store(HttpRequest $request, $forum_id)
{
$this->validate($request, ['title' => 'required', 'body' => 'required']);
$forum = Forum::findOrFail($forum_id);
$this->authorizePost($forum, null);
$topic = Topic::createNew($forum, $request->input('title'), Auth::user(), $request->input('body'), false)->fresh();
Event::fire(new TopicWasCreated($topic, $topic->posts->last(), Auth::user()));
return ujs_redirect(route('forum.topics.show', $topic));
}
示例4: ship
public function ship()
{
$order = Store\Order::where('status', 'paid')->where('tracking_code', 'like', 'EJ%')->get();
foreach ($order as $o) {
$o->status = 'shipped';
$o->save();
}
return ujs_redirect(route('store.admin.orders.index'));
}
示例5: register
public function register($id)
{
$tournament = Tournament::findOrFail($id);
$user = Auth::user();
if (!$tournament->isRegistrationOpen()) {
return error_popup('registrations are closed!');
}
if (!$tournament->isValidRank($user)) {
return error_popup('invalid rank!');
}
$tournament->register($user);
return ujs_redirect("/tournaments/{$id}");
}
示例6: index
public function index()
{
$host = Request::getHttpHost();
$subdomain = substr($host, 0, strpos($host, '.'));
if ($subdomain === 'store') {
return ujs_redirect(route('store.products.index'));
}
if (Auth::check()) {
return ujs_redirect(route('forum.forums.index'));
}
$stats = BanchoStats::whereRaw('banchostats_id mod 10 = 0')->orderBy('banchostats_id', 'DESC')->limit(24 * 60 / 10)->get();
$totalUsers = Count::totalUsers();
$currentOnline = $stats->isEmpty() ? 0 : $stats->last()->users_osu;
return view('home.landing', compact('stats', 'totalUsers', 'currentOnline'));
}
示例7: destroy
public function destroy($id)
{
$post = Post::findOrFail($id);
$this->authorizePost($post->forum, $post->topic);
if (!$post->canBeDeletedBy(Auth::user())) {
abort(403);
}
$deletedPostPosition = $post->topic->postPosition($post->post_id);
$post->topic->removePost($post);
$topic = Topic::find($post->topic_id);
if ($topic === null) {
$redirect = route('forum.forums.show', $post->forum);
return ujs_redirect($redirect);
}
return ['postId' => $post->post_id, 'postPosition' => $deletedPostPosition];
}
示例8: postCheckout
public function postCheckout()
{
$order = $this->userCart();
if (!$order) {
return response(["message" => "cart is empty"], 422);
}
$order->refreshCost(true);
if ($order->getTotal() == 0 && Request::input("completed")) {
file_get_contents("https://osu.ppy.sh/web/ipn.php?mc_gross=0&item_number=store-{$order->user_id}-{$order->order_id}");
return ujs_redirect(action("StoreController@getInvoice", [$order->order_id]) . "?thanks=1");
}
return js_view("store.order-create");
}
示例9: show
public function show($id)
{
$user = User::lookup($id);
if ($user === null || !$user->hasProfile()) {
abort(404);
}
if ((string) $user->user_id !== $id) {
return ujs_redirect(route('users.show', $user));
}
$achievements = json_collection(Achievement::achievable()->orderBy('grouping')->orderBy('ordering')->orderBy('progression')->get(), new AchievementTransformer());
$userArray = json_item($user, new UserTransformer(), ['userAchievements', 'allRankHistories', 'allScores', 'allScoresBest', 'allScoresFirst', 'allStatistics', 'beatmapPlaycounts', 'page', 'recentActivities', 'recentlyReceivedKudosu', 'rankedAndApprovedBeatmapsets.beatmaps', 'favouriteBeatmapsets.beatmaps']);
return view('users.show', compact('user', 'userArray', 'achievements'));
}
示例10: voteFeature
public function voteFeature($topicId)
{
$star = FeatureVote::createNew(['user_id' => Auth::user()->user_id, 'topic_id' => $topicId]);
if ($star->getKey() !== null) {
return ujs_redirect(route('forum.topics.show', $topicId));
} else {
return error_popup(implode(' ', $star->validationErrors()->allMessages()));
}
}
示例11: show
public function show($id)
{
$post = Post::findOrFail($id);
priv_check('ForumView', $post->forum)->ensureCan();
return ujs_redirect(post_url($post->topic_id, $post->post_id));
}
示例12: function
// community section (forum will end up being a section of its own)
Route::get('/community/forum', function () {
return Redirect::to('/forum');
});
Route::resource('livestreams', 'LivestreamsController', ['only' => ['index']]);
Route::post('livestreams/promote', ['as' => 'livestreams.promote', 'uses' => 'LivestreamsController@promote']);
Route::get('/community/chat', ['as' => 'chat', 'uses' => 'CommunityController@getChat']);
Route::get('/community/profile/{id}', function ($id) {
return Redirect::route('users.show', $id);
});
Route::get('/community/slack', ['as' => 'slack', 'uses' => 'CommunityController@getSlack']);
Route::post('/community/slack/agree', ['as' => 'slack.agree', 'uses' => 'CommunityController@postSlackAgree']);
Route::resource('matches', 'MatchesController', ['only' => ['show']]);
Route::get('/matches/{match}/history', ['as' => 'matches.history', 'uses' => 'MatchesController@history']);
Route::get('/mp/{match}', function ($match) {
return ujs_redirect(route('matches.show', ['match' => $match]));
});
Route::post('users/check-username-availability', ['as' => 'users.check-username-availability', 'uses' => 'UsersController@checkUsernameAvailability']);
Route::post('users/login', ['as' => 'users.login', 'uses' => 'UsersController@login']);
Route::delete('users/logout', ['as' => 'users.logout', 'uses' => 'UsersController@logout']);
Route::get('users/disabled', ['as' => 'users.disabled', 'uses' => 'UsersController@disabled']);
// Authentication section (Temporarily set up as replacement/improvement of config("osu.urls.*"))
Route::get('users/forgot-password', ['as' => 'users.forgot-password', function () {
return Redirect::to('https://osu.ppy.sh/p/forgot');
}]);
Route::get('users/register', ['as' => 'users.register', function () {
return Redirect::to('https://osu.ppy.sh/p/register');
}]);
Route::get('u/{user}', ['as' => 'users.show', 'uses' => 'UsersController@show']);
// help section
Route::get('/wiki', ['as' => 'wiki', function () {
示例13: show
public function show($id)
{
$beatmap = Beatmap::findOrFail($id);
$set = $beatmap->beatmapset;
return ujs_redirect(route('beatmapsets.show', ['beatmap' => $set->beatmapset_id]) . '#' . $beatmap->mode . '/' . $id);
}
示例14: postCheckout
public function postCheckout()
{
$order = $this->userCart();
if (!$order) {
return response(['message' => 'cart is empty'], 422);
}
$order->refreshCost(true);
if ((double) $order->getTotal() === 0.0 && Request::input('completed')) {
file_get_contents("https://osu.ppy.sh/web/ipn.php?mc_gross=0&item_number=store-{$order->user_id}-{$order->order_id}");
return ujs_redirect(action('StoreController@getInvoice', [$order->order_id]) . '?thanks=1');
}
return js_view('store.order-create');
}
示例15: postCheckout
public function postCheckout()
{
$order = $this->userCart();
if ($order->items()->count() === 0) {
return error_popup('cart is empty');
}
$order->checkout();
if ((double) $order->getTotal() === 0.0 && Request::input('completed')) {
file_get_contents("https://osu.ppy.sh/web/ipn.php?mc_gross=0&item_number=store-{$order->user_id}-{$order->order_id}");
return ujs_redirect(action('StoreController@getInvoice', [$order->order_id]) . '?thanks=1');
}
return js_view('store.order-create');
}