A Laravel package to manage polls on Darkpony Barb CMS
First, install the package through Composer.
composer require darkperis/wcms-polls
Publish migrations, and migrate
php artisan vendor:publish
php artisan migrate
A wcmspolls_config.php file will be added where you can put the name of the middleware used to protect the access and other things like pagination and prefix to protect your routes Add this line in the .env too
POLL_ADMIN_AUTH_MIDDLEWARE = auth
POLL_ADMIN_AUTH_GUARD = web
POLL_PAGINATION = 10
POLL_PREFIX = custompath
Specify the ID of the poll
{{ PollWriter::draw(Darkpony\WCMSPolls\Poll::find([POLL_ID])) }}
You can override the views related to the results page and both pages checkbox/radio via the same wcmspolls_config.php file in the config folder.
{{ route('poll.vote', $id) }}
- $question : the question of the poll
- $options : array of objects holding (name, percent, votes).
- $question : the question
- $options : holding the name and id of the option.