Download the PHP package hootlex/laravel-moderation without Composer

On this page you can find all versions of the php package hootlex/laravel-moderation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-moderation

Laravel Moderation Build Status Version Total Downloads

A simple Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc.

Keep your application pure by preventing offensive, irrelevant, or insulting content.

Possible Use Case

  1. User creates a resource (a post, a comment or any Eloquent Model).
  2. The resource is pending and invisible in website (ex. Post::all() returns only approved posts).
  3. Moderator decides if the resource will be approved, rejected or postponed.

    1. Approved: Resource is now public and queryable.
    2. Rejected: Resource will be excluded from all queries. Rejected resources will be returned only if you scope a query to include them. (scope: withRejected)
    3. Postponed: Resource will be excluded from all queries until Moderator decides to approve it.
  4. You application is clean.

Installation

First, install the package through Composer.

If you are using Laravel < 5.5, you need to add Hootlex\Moderation\ModerationServiceProvider to your config/app.php providers array:

Lastly you publish the config file.

Prepare Model

To enable moderation for a model, use the Hootlex\Moderation\Moderatable trait on the model and add the status, moderated_by and moderated_at columns to your model's table.

Create a migration to add the new columns. (You can use custom names for the moderation columns)

Example Migration:

You are ready to go!

Usage

Note: In next examples I will use Post model to demonstrate how the query builder works. You can Moderate any Eloquent Model, even User.

Moderate Models

You can moderate a model Instance:

or by referencing it's id

or by making a query.

Query Models

By default only Approved models will be returned on queries. To change this behavior check the configuration.

To query the Approved Posts, run your queries as always.
Query pending or rejected models.
Query ALL models

Model Status

To check the status of a model there are 3 helper methods which return a boolean value.

Strict Moderation

Strict Moderation means that only Approved resource will be queried. To query Pending resources along with Approved you have to disable Strict Moderation. See how you can do this in the configuration.

Configuration

Global Configuration

To configuration Moderation package globally you have to edit config/moderation.php. Inside moderation.php you can configure the following:

  1. status_column represents the default column 'status' in the database.
  2. moderated_at_column represents the default column 'moderated_at' in the database.
  3. moderated_by_column represents the default column 'moderated_by' in the database.
  4. strict represents Strict Moderation.

Model Configuration

Inside your Model you can define some variables to overwrite Global Settings.

To overwrite status column define:

To overwrite moderated_at column define:

To overwrite moderated_by column define:

To enable or disable Strict Moderation:


All versions of laravel-moderation with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hootlex/laravel-moderation contains the following files

Loading the files please wait ....