Skip to content

melogail/laravel-reviews

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

contributions welcome version 1.0.0

laravel-Reviews

Laravel Tags package for Laravel framework applications, it is useful for adding tags to different models in the application, useful for Blogs, eCommerce...etc

How to use

Installation

  • Install the package using composer in your project.
composer require melogail/laravel-reviews
  • Publish the package migration files, config file config/laravel-reviews, and migration files.
php artisan vendor:publish --tag=reviews_data
  • Update your autoload files
composer dump-autoload -o
  • Migrate your new migration files
php artisan migrate
  • Add the reviewable trait inside your desired models to have tags
use Melogail\LaravelTags\Reviweable;

class Articles extends Model {
    
    use Reviewable;
    
    // model code follow...

}
  • Inside config/ directory, add the model class where reviewer_id will match. ex: users table.
'models' => [

        'reviewer' => [

            'class' => App\User::class,  // model reviewer

        ]

    ]

Usage

To get all the tags added for specific model, use a foreach loop:

foreach ($article->reviews as $review) {
    $tag->name;
}

To add review, you use the addReview($data = []) method on your object.

$article->addReview($data)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages