Giter VIP home page Giter VIP logo

oc-likes-plugin's Introduction

oc-likes-plugin

Rate a specific object

To configure the plugin for a specific record in the database, just connect the component and specify the model namespace and record ID. For example, the first user of the plugin RainLab.User

[LikeButton]
likeable_type = "October\Rain\Auth\Models\User"
likeable_id = 1

Rate a specific object from url

Let's say you have a page "/users/:id". To configure the plugin in such a way as to rate the user this page belongs to, you need to set the likeable_id so that it corresponds to the id variable

[LikeButton]
likeable_type = "October\Rain\Auth\Models\User"
likeable_id = "{{ :id }}"

Likes in list

Alternatively, you can pass the object ID directly to the component. This is useful, for example, when listing objects. Let's say you are listing posts. In this case, just connect the component, specify the model, and pass the ID when listing.

[LikeButton]
likeable_type = "October\Rain\Auth\Models\User"
likeable_id = "1"
{% for user in users %}
 {% component 'LikeButton' likeable_id=user.id %}
{% endfor %}

oc-likes-plugin's People

Contributors

vaal2004 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.