mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-03 16:59:32 -05:00
refactor: preslash simple functions
- Add pre-slash to short named functions to improve performance by almost 30% - @see https://stackoverflow.com/questions/55419673/php7-adding-a-slash-to-all-standard-php-functions-php-cs-fixer-rule
This commit is contained in:
@@ -46,7 +46,7 @@ class PollController extends Controller
|
||||
{
|
||||
$polls = Poll::latest()->paginate(15);
|
||||
|
||||
return view('poll.latest', ['polls' => $polls]);
|
||||
return \view('poll.latest', ['polls' => $polls]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,11 +64,11 @@ class PollController extends Controller
|
||||
$user_has_voted = $poll->voters->where('user_id', '=', $user->id)->isNotEmpty();
|
||||
|
||||
if ($user_has_voted) {
|
||||
return redirect()->route('poll_results', ['id' => $poll->id])
|
||||
return \redirect()->route('poll_results', ['id' => $poll->id])
|
||||
->withInfo('You have already vote on this poll. Here are the results.');
|
||||
}
|
||||
|
||||
return view('poll.show', ['poll' => $poll]);
|
||||
return \view('poll.show', ['poll' => $poll]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ class PollController extends Controller
|
||||
->where('poll_id', '=', $poll->id)
|
||||
->exists();
|
||||
if ($voted) {
|
||||
return redirect()->route('poll_results', ['id' => $poll->id])
|
||||
return \redirect()->route('poll_results', ['id' => $poll->id])
|
||||
->withErrors('Bro have already vote on this poll. Your vote has not been counted.');
|
||||
}
|
||||
|
||||
@@ -101,14 +101,14 @@ class PollController extends Controller
|
||||
$vote->user_id = $user->id;
|
||||
$vote->save();
|
||||
|
||||
$poll_url = href_poll($poll);
|
||||
$profile_url = href_profile($user);
|
||||
$poll_url = \href_poll($poll);
|
||||
$profile_url = \href_profile($user);
|
||||
|
||||
$this->chat->systemMessage(
|
||||
sprintf('[url=%s]%s[/url] has voted on poll [url=%s]%s[/url]', $profile_url, $user->username, $poll_url, $poll->title)
|
||||
\sprintf('[url=%s]%s[/url] has voted on poll [url=%s]%s[/url]', $profile_url, $user->username, $poll_url, $poll->title)
|
||||
);
|
||||
|
||||
return redirect()->route('poll_results', ['id' => $poll->id])
|
||||
return \redirect()->route('poll_results', ['id' => $poll->id])
|
||||
->withSuccess('Your vote has been counted.');
|
||||
}
|
||||
|
||||
@@ -127,6 +127,6 @@ class PollController extends Controller
|
||||
'total_votes' => $poll->totalVotes(),
|
||||
];
|
||||
|
||||
return view('poll.result', $map);
|
||||
return \view('poll.result', $map);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user