Download the PHP package maize-tech/laravel-markable without Composer
On this page you can find all versions of the php package maize-tech/laravel-markable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download maize-tech/laravel-markable
More information about maize-tech/laravel-markable
Files in maize-tech/laravel-markable
Download maize-tech/laravel-markable
More information about maize-tech/laravel-markable
Files in maize-tech/laravel-markable
Vendor maize-tech
Package laravel-markable
Short Description Laravel Markable
License MIT
Homepage https://github.com/maize-tech/laravel-markable
Package laravel-markable
Short Description Laravel Markable
License MIT
Homepage https://github.com/maize-tech/laravel-markable
Please rate this library. Is it a good library?
Informations about the package laravel-markable
# Laravel Markable [![Latest Version on Packagist](https://img.shields.io/packagist/v/maize-tech/laravel-markable.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-markable) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-markable/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/maize-tech/laravel-markable/actions?query=workflow%3Arun-tests+branch%3Amain) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-markable/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/maize-tech/laravel-markable/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/maize-tech/laravel-markable.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-markable) This package allows you to easily add the markable feature to your application, as for example likes, bookmarks, favorites and so on. ## Installation You can install the package via composer: You can publish and run the migrations with: You can publish the config file with: This is the content of the published config file: ## Usage ### Basic To use the package, add the `Maize\Markable\Markable` trait to the model where you want to have marks. Once done, you can define the list of possible marks for the given model implementing the `$marks` array with the list of mark classes' namespace. Here's an example model including the `Markable` trait and implementing the `Like` mark: You can now assign likes to the model: ### Custom metadata If needed, you may also add custom metadata when assigning a mark: ### Custom mark model The package allows you to define custom marks. First thing you need to do is create a migration which defines the new mark model. The package works with separate tables for each mark in order to increase the performances when executing related queries. The migration table name should contain the prefix defined in `table_prefix` attribute under `config/markable.php`. Default prefix is set to `markable_`. Here's an example migration for bookmarks: Once done, you can create a new class which extends the abstract `Mark` class and implement the `markableRelationName` method, which is used to retrieve the users who marked a given model entity with the mark entity as pivot. You can also override the `markRelationName` method, which is used to retrieve the list of marks of a given model entity. By default, the relation name is the plural name of the mark class name. Here's an example model for the bookmarks mark: That's all! You can now include the custom mark to all models you wish and use it as explained before. ### Working with mark values You might need a custom mark with a subset of allowed values. In this case, you can just define your custom mark as explained before and add the list of allowed values in `allowed_values` array under `config/markable.php`. The array key name should match the mark's class name in lower case. Here's an example when working with reactions: You can then use the custom mark with values: You can also use wildcards to allow any value for a specific mark. Here's an example when working with reactions: When set, you can use any value when giving a reaction: ### Retrieve the list of marks of an entity with eloquent ### Retrieve the list of users who marked an entity with eloquent ### Filter marked models with eloquent ## Testing ## Changelog Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. ## Contributing Please see [CONTRIBUTING](https://github.com/maize-tech/.github/blob/main/CONTRIBUTING.md) for details. ## Security Vulnerabilities Please review [our security policy](https://github.com/maize-tech/.github/security/policy) on how to report security vulnerabilities. ## Credits - [Enrico De Lazzari](https://github.com/enricodelazzari) - [Riccardo Dalla Via](https://github.com/riccardodallavia) - [All Contributors](../../contributors) ## License The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
All versions of laravel-markable with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.0
illuminate/database Version ^9.0|^10.0|^11.0
illuminate/support Version ^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.14.1
illuminate/database Version ^9.0|^10.0|^11.0
illuminate/support Version ^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.14.1
The package maize-tech/laravel-markable contains the following files
Loading the files please wait ....