aabosham/laravel-favorite

Create favorite for any models for laravel framework

v1.0.4 2022-12-05 21:15 UTC

This package is auto-updated.

Last update: 2024-04-08 16:25:10 UTC


README

Favoritable is a package for Laravel.

Installation

From the command line, run:

composer require aabosham/laravel-favorite
php artisan migrate
<?php

namespace App;

use Aabosham\Favoritable\Favoritable;

class Post extends Model
{
    use favoritable;

    ...
}
$model->isFavoritedBy();


$model->favorite();

$model->favoritesCount();

Scoping

$models = Model::FavoritedBy(User $user)->get();