mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-29 23:09:42 -05:00
(Update) Poll System
This commit is contained in:
@@ -17,7 +17,6 @@ use App\Repositories\ChatRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Poll;
|
||||
use App\Option;
|
||||
use App\Message;
|
||||
use App\Http\Requests\StorePoll;
|
||||
use Cache;
|
||||
use \Toastr;
|
||||
@@ -34,20 +33,32 @@ class PollController extends Controller
|
||||
$this->chat = $chat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show All Polls
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function polls()
|
||||
{
|
||||
$polls = Poll::latest()->paginate(25);
|
||||
return view('Staff.poll.polls', compact('polls'));
|
||||
}
|
||||
|
||||
public function poll($id)
|
||||
{
|
||||
$poll = Poll::where('id', $id)->firstOrFail();
|
||||
return view('Staff.poll.poll', compact('poll'));
|
||||
return view('Staff.poll.polls', ['polls' => $polls]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* Show A Poll
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function poll($id)
|
||||
{
|
||||
$poll = Poll::where('id', $id)->firstOrFail();
|
||||
|
||||
return view('Staff.poll.poll', ['poll' => $poll]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Poll Add Form
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
@@ -57,10 +68,10 @@ class PollController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* Add A Poll
|
||||
*
|
||||
* @param StorePoll $request
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StorePoll $request)
|
||||
{
|
||||
@@ -86,6 +97,7 @@ class PollController extends Controller
|
||||
"A new poll has been created [url={$poll_url}]{$poll->title}[/url] vote on it now! :slight_smile:"
|
||||
);
|
||||
|
||||
return redirect('poll/' . $poll->slug)->with(Toastr::success('Your poll has been created.', 'Yay!', ['options']));
|
||||
return redirect('poll/' . $poll->slug)
|
||||
->with(Toastr::success('Your poll has been created.', 'Yay!', ['options']));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user