Download the PHP package hannoma/larapolls without Composer
On this page you can find all versions of the php package hannoma/larapolls. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hannoma/larapolls
More information about hannoma/larapolls
Files in hannoma/larapolls
Package larapolls
Short Description Create, view and manage polls in Laravel Framework
License MIT
Informations about the package larapolls
Larapolls
Laravel package for displaying, creating and managing polls with permissions!
- Installation
- Configuration
- Localization
- Views
- Usage
- Permission Setup
- Displaying Polls
Installation
You can install the package via composer:
In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in config/app.php
file:
You can publish the package files with:
Because this package uses spatie/laravel-permission for the permissions, you should publish the migration files of that package too:
After the migration has been published you can create the poll and permission-tables by running the migrations:
Configuration
All important configuration options can be found in the config/larapolls.php
file:
NOTE: The permissions defined in the standard_permissions
array are added to the role larapolls_standard
when you first access the home route of Larapolls. If you want to add or remove permissions from this role later on, do this:
Or you can remove the role for some users:
Localization
After publishing the vendor files of this package, you can find the localization files in resources/lang/vendor/larapolls/
.
Supported languages by this package are:
- English
- German
If you want to add your locale, create the folder resources/lang/vendor/larapolls/YOUR LOCALE/
. Then just copy the larapolls.php
localization file of another locale and translate the strings. If you add your locale, I would be very thankful if you create a pull request with your locale ^^
Views
This package was created and designed with Bootstrap version 4.x, but gives you the option to use Bootstrap version 3.x instead. Therefor you need to change the value bootstrap_v4
to false
in the config/larapolls.php
file.
The templates for Bootstrap version 4.x are called *_v4.blade.php
, the templates for version 3.x *_v3.blade.php
.
NOTE: Because the package was created with version 4.x, the view files for version 3.x contain the same code as the view files for version 4! So you need to change some things in order that they work with version 3.x!
Personalizing
After publishing the package vendor files, you can find the blade templates in resources/views/vendor/larapolls/
.
All your changes in these files will be displayed on your site.
NOTE: DO NOT change any if conditions or other blade commands otherwise this package may not work anymore!
Usage
First, add the Spatie\Permission\Traits\HasRoles
trait to your User
model(s).
Please use the user model App\User
, because otherwise there will be errors using Larapolls:
Permission Setup
This package comes with artisan commands to setup permissions for different roles and categories.
Just run php artisan larapolls:setup_roles
and use these options:
--A
or--admin
for a admin role--M
or--moderator
for a moderator (bound to a specific category)--D
or--defaultMember
for a member of a specific category
Displaying Polls
All polls are displayed on the larapolls.home
route.
You can display polls of a category with the larapolls.category
route which takes the parameter category
.
You can also display a poll with a given id on any page with:
If you use this command, make sure that you import the Font Awesome version 5.x in your page.
If you have categories that shall be only accessed by admins or users with permission, add your category in the protectedCategories
array in the config file and give the users that you want to access this category the appertaining permission:
If you have not create this permission before, you may want to do this: