orangeshadow / polls
A Laravel package to create your polls
Requires
- php: >=7.0
- illuminate/routing: 5.5.x|5.6.x
- illuminate/session: 5.5.x|5.6.x
- illuminate/support: 5.5.x|5.6.x
Requires (Dev)
- orchestra/testbench: ~3.0
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-11-06 09:31:56 UTC
README
Install
composer require orangeshadow/polls:dev-master
then copy config, migration and lang
php artisan vendor:publish OrangeShadow\\Polls\\SeriviceProvider
run migration
php artisan migrate
Config
polls.php
routing
- enable or disable routing
admin_route_prefix
- prefix for manage polls API route
admin_route_middleware
- array middleware for manage polls route
public_route_prefix
- prefix for public API route
public_route_middleware
- array for manage polls route
paginate
- count items returned from api
Objects
Routes
admin route:
GET: /admin/poll - Get poll list
POST: /admin/poll - Store Poll
GET: /admin/poll/{poll} - Show poll
PUT: /admin/poll/{poll} - Update poll
DELETE: /admin/poll/{poll} - Remove poll
POST: /admin/poll/{poll}/close - Close Poll
GET: /admin/option - Get option list
POST: /admin/option - Store Option
GET: /admin/option/{option} - Show option
PUT: /admin/option/{option} - Update option
DELETE: /admin/option/{option} Remove option
public route for get poll with options (and result if user did voted)
POST: poll/{poll}
public route for voting (only for auth user)
POST: poll/{poll}/vote
FORM-DATA: {
options: array
}
Facade PollProxy
$pollProxy = app('PollPropxy',['poll'=>$poll])
Save Vote:
$pollProxy->voting($user_id,$options);
Get Result Array:
$pollProxy->getResult();