Download the PHP package nestermaks/laravel-pricelist without Composer

On this page you can find all versions of the php package nestermaks/laravel-pricelist. 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-pricelist

Multilingual pricelist package for Laravel with migrations and API controllers

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package allows you to manage your pricelists and reorder items inside. It's not a kind of pricing tables, where you have a list of features and a price below. It is responsible for creating lists, where every item has its own price. Also every item can belong to many pricelists.

This package includes:

  1. Models
  2. Migrations
  3. Api routes
  4. Api controllers
  5. Translations
  6. Config file

Table of contents

Installation

You can install the package via composer:

Publish and run the migrations with:

Configuration

You can override translation files of add a new one. Publish lang files with:

You can override the default options for used locales, api route prefixes and validation rules. Publish the configuration:

This is the contents of the published config file:

Database

Migrations files are provided with such tables:

  1. pricelists. This table is like a container for pricelist items. It has such fields:

    • order - sets priority on a frontend
    • active - defines if the pricelist is active or not

    Translatable fields of the table 'pricelists' are in the table 'pricelist_translations'. Table 'pricelists' has many pricelist translations

  2. pricelist_translations. Fields:
    • pricelist_id - id of the related pricelist
    • locale - language of translation
    • title - title of the pricelist
    • description - description of the pricelist if needed

  1. pricelist_items. Elements of pricelists. Fields:

    • shortcut - for internal usage to identify your pricelist item. For example, if you have different items with the same title
    • price - price of your product. In case the 'max_price' field is set, this one stands for minimum price.
    • max_price - if your product has no fixed price this field describes maximum price.
    • price_from - if the price of your product starts from the value set in 'price' field and has no upper bound. Boolean.
    • active - defines if the pricelist item is active or not

    Translatable fields of the table 'pricelist_items' are in the table 'pricelist_items_translations'. Table 'pricelists' has many pricelist translations

  2. pricelist_items_translations. Fields:
    • pricelist_item_id - id of the related pricelist item
    • locale - language of translation
    • title - name of your product
    • units - in what units your product can be calculated

  1. pricelist_pricelist_item. Pivot table for pricelists and pricelist_items in many to many relationship. Also contains field 'item_order', which defines order of an element within the table.

  2. pricelistables. Polymorphic many to many relationship table. Responsible for attaching a pricelist to your pricelistable models.

Usage

Registering Models

To let your models be able to attach pricelists, add the HasPricelist trait to your model class

Associating pricelists

You can associate a pricelist with a model like this:

Or you can detach pricelist from a model:

To watch all pricelists of the model:

Show pricelists and pricelist items

To show all active pricelists:

The same for pricelist items

To show pricelist items related to the pricelist:

To show pricelists where the pricelist item is present:


Attach and detach pricelist items to pricelist

Assuming we have such variables:

To attach items to the pricelist:

Or to attach one pricelist item to many pricelists:

To detach items from the pricelist:

To detach item from given pricelists:

Notice that the argument in all these cases is a Collection.

Reordering pricelist items within the pricelist

When you attach pricelist items to the pricelist, each of them gets its order number. To see order number of a pricelist item in the pricelist use:

or

To set a new order number of a pricelist item within the pricelist use:

or

Second argument is for new order number. After you assign a new order number of the pricelist item, another ones will rearrange appropriately inside the pricelist.

Api routes

You may use api calls to manage your pricelists. Set desired api prefixes in a config file or leave it default. For pricelists and pricelists items CRUDS are used api resource routes with api resource controllers. You may look through the Laravel DOCS.

CRUDS

Pricelists

Parameters to use in CRUDS:

  1. title
  2. description
  3. lang
  4. order
  5. active

For example, to update a pricelist with id "12" make a patch request:

Pricelist items

Parameters to use in CRUDS:

  1. title
  2. units
  3. lang
  4. shortcut
  5. price
  6. max_price
  7. price_from
  8. active

For example, to update a pricelist with id "12" item make a patch request:


Attach and detach pricelists from pricelist items

Make a POST request. URL should look like:

Parameters:

  1. action (can be 'detachItems' or 'attachItems')
  2. pricelist_id
  3. pricelist_items_id

One of the parameters of pricelist_id and pricelist_items_id should be an integer while another one should be an array.

Example:

Associate pricelist with your model

Make a POST request. URL should look like:

Parameters:

  1. action (can be addPricelist or removePricelist)
  2. model_name (should be a fully qualified class name of your model)
  3. model_id
  4. pricelist_id

Example:

Show related pricelists of your model

Make a GET request. URL should look like:

Parameters:

  1. model_name (should be a fully qualified class name of your model)
  2. model_id

Example:

Change pricelist item order within a pricelist

Make a POST request. URL should look like:

Parameters:

  1. pricelist_id
  2. pricelist_item_id
  3. item_order (new order number of the pricelist item in a pricelist)

Example:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-pricelist with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
astrotomic/laravel-translatable Version ^11.9
illuminate/contracts Version ^8.37
spatie/laravel-package-tools Version ^1.4.3
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 nestermaks/laravel-pricelist contains the following files

Loading the files please wait ....