unionco / modtool
Union.co Moderation Tool (Laravel 5.2 Package)
Requires
- php: >=5.5.9
- bugsnag/bugsnag-laravel: 1.*
- fideloper/proxy: ~4.0
- fzaninotto/faker: 1.*
- jedrzej/pimpable: 0.0.4
- laravel/framework: 5.2.*
- league/flysystem-aws-s3-v3: ^1.0
- predis/predis: 1.*
- venturecraft/revisionable: 1.*
This package is not auto-updated.
Last update: 2024-11-13 05:11:06 UTC
README
The purpose of this tool is to store/centralize every user generated content (UGC) and allow internal users to moderate these submissions. The UGC should be created through an API (see below) and stored on the database, while attachments will be stored on Amazon S3, and the moderation should be done through the project's web interface.
This tool was created for Pall Mall, has been used for Camel (adapted as an Artist Pick Tool) and is flexible enough to be adapted to any Laravel project that has UGC which has to be moderated or managed.
Requirements
You'll need these software versions to run the project:
- PHP 5.6+
- Laravel 5.2+
- MySQL 5.X+
Components
These are the Composer components used on the project. You can find useful information on their documentations.
- Bugsnag notifier -- bug reporting
- Revisionable -- database audit trail
- Pimpable -- API filtering, sorting and relating
- Faker -- for database seeding
- TrustedProxy -- Proxy Package for handling sessions on load balance environments
- Flysystem-AWS-S3 -- Flysystem Adapter for AWS SDK V3
Accounts
You'll need an active account on these services and set the credentials on the .env file (see below):
- Amazon S3
- Bugsnag
- SMTP
API
The backend application was designed to be used through API only, so every data CRUD has to be made through it.
For frontend authentication without an API_TOKEN, use the path /ajax/ instead of /api/v1. The same routing and parameters will apply.
Check the API documentation (Postman) here.
For the Requests Collection, click here.
Installation
With PHP, Apache and MySQL installed:
Via Composer:
For Laravel versions 5.5+, Package Auto-Discover will add the Service Provider for you. For versions below 5.5, add the Service Provider manually in config/app.php:
```Unionco\Modtool\ModtoolServiceProvider::class```
If you don't have the users and roles tables, run
```php artisan make:auth```
Define your tables, fields and models on the `.env` file and run
```php artisan migrate```
```php artisan db:seed```
To copy the images and compiled javascript and css to the public folder, run
```php artisan vendor:publish --tag=public```
#### .env file
All these settings must be filled in the .env file.
The MOD_TOOL_* settings are for defining tables, columns and models names, which can be from your project or new ones. Below you'll find their default values.
If your project doesn't have tables for EntityType and EntitySubtype, set the conf MOD_TOOL_CREATE_ENTITIES_TABLES to 1 and the Database Migration will create these tables for you.
```
DB_CONNECTION=mysql
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
MAIL_FROM_NAME='Pall Mall Website'
MAIL_FROM_ADDRESS='pallmall@union.co'
MAIL_DEFAULT_TO_NAME='Filipe Knoedt'
MAIL_DEFAULT_TO_ADDRESS='filipe.knoedt@union.co'
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
AWS_BUCKET=
;AWS_URL=
BUGSNAG_API_KEY=
MOD_TOOL_STORAGE_DRIVER='s3'
MOD_TOOL_TBL_UGC='pm_mod_ugc'
MOD_TOOL_TBL_STATUS_CODES='pm_mod_status_codes'
MOD_TOOL_TBL_CONTENT_TYPE='pm_mod_content_type'
MOD_TOOL_TBL_USERS='users'
MOD_TOOL_TBL_ROLE='roles'
MOD_TOOL_TBL_ROLE_USER='role_user_test'
MOD_TOOL_CREATE_ENTITIES_TABLES=1
MOD_TOOL_TBL_ENTITY_TYPES='pm_entity_types_dummy'
MOD_TOOL_PK_ENTITY_TYPES='id'
MOD_TOOL_NAME_ENTITY_TYPES='entity_name'
MOD_TOOL_MODEL_ENTITY_TYPES='Unionco\\Modtool\\Models\\ModEntityType'
MOD_TOOL_TBL_ENTITY_SUBTYPES='pm_entity_subtypes_dummy'
MOD_TOOL_PK_ENTITY_SUBTYPES='id'
MOD_TOOL_NAME_ENTITY_SUBTYPES='subtype_name'
MOD_TOOL_MODEL_ENTITY_SUBTYPES='Unionco\\Modtool\\Models\\ModEntitySubtype'
MOD_TOOL_TBL_PROFILES='pm_epsilon_profiles'
MOD_TOOL_PK_PROFILES='profileID'
MOD_TOOL_MODEL_PROFILES='Unionco\\Modtool\\Models\\ModProfile'
```
#### Front End Setup
- npm install
- npm run watch
#### React Components
* UgcTable -- Holds the UGC data and renders the UGC table
* UsersTable -- Holds the Users data and renders the Users table
* AuditTrailTable -- Holds the Audit Trail data and renders the AuditTrial table
* BulkChangeStatus -- Handles the bulk status update logic
* ChangeStatus -- Handles the single status update logic
* Stats -- Holds and renders a Stat component for the homepage dashboard
* TableCheckbox -- Renders a checkbox
* TableCheckboxHeader -- Renders a checkbox in the table header and holds logic to select all checkboxes