Download the PHP package data33/laravel-poll without Composer
On this page you can find all versions of the php package data33/laravel-poll. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download data33/laravel-poll
More information about data33/laravel-poll
Files in data33/laravel-poll
Package laravel-poll
Short Description A Laravel 5 package for creating, managing and interacting with polls
License MIT
Homepage https://github.com/Data33/laravel-poll
Informations about the package laravel-poll
Data33/Laravel-Poll
A package for managing polls in Laravel.
Installation
Open your composer.json
file and add the following to the require
key:
"data33/laravel-poll": "^1.0.1"
After adding the key, run composer update from the command line to install the package
Configuration
Before you can start using the package we need to set some configurations.
To do so you must first publish the config file, you can do this with the following artisan
command.
After running the above command, you should see the following changes:
- A config file should be available at
config/polls.php
- A few new migrations should be placed in your
database/migrations
folder - A few new views should be placed in the folder
resources/views/vendor/data33/laravel-poll
If you wish to extend this package, you can specify your own classes to be used as models in the config/polls.php
file. Make sure your models extend the existing ones.
Usage
Creating a new poll
You can either create polls manually by using the models directly, or you can use the createPoll helper method.
Adding more options
If you need to add more options to a poll after it has already been created you may use the addOption method.
Voting for an option
Let's assume your App\User model uses the Voter trait.