Getting started
Integrate user interactions to your Laravel application like: followers, subscribers, likes, participants, etc
First install it using Composer:
composer require open-southeners/laravel-user-interactions
Then publish the required database migrations and config file:
php artisan vendor:publish --provider="OpenSoutheners\\LaravelUserInteractions\\ServiceProvider"
Run the migrations and you're almost all setup, now you need to configure the interactable models to be able to query and perform interactions from and into these models.
For example for your User model:
<?php
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use OpenSoutheners\LaravelUserInteractions\Concerns\InteractsWith;
use OpenSoutheners\LaravelUserInteractions\Contracts\Interactable;
class User extends Authenticatable
{
;
// The rest of your code here...
}
And the models where your users will interact into:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use OpenSoutheners\LaravelUserInteractions\Concerns\InteractsWith;
use OpenSoutheners\LaravelUserInteractions\Contracts\Interactable;
class Post extends Model implements Interactable
{
use InteractsWith;
// The rest of your code here...
}
And you are all set! 🎉
Last updated
Was this helpful?