Setup Reacterable

User model cannot directly react to the content. It should delegate this job to related Reacter model.

Code Changes

  1. Declare that model implements Cog\Contracts\Love\Reacterable\Models\Reacterable contract.

  2. Use Cog\Laravel\Love\Reacterable\Models\Traits\Reacterable trait or implement each method of the contract by yourself.

As result you will have:


namespace App\Models;

use Cog\Contracts\Love\Reacterable\Models\Reacterable as ReacterableInterface;
use Cog\Laravel\Love\Reacterable\Models\Traits\Reacterable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements ReacterableInterface
    use Reacterable;

Database Changes

  1. Run set up reacterable command.
php artisan love:setup-reacterable --model="App\Models\User"


Add --nullable flag if all models of this type must NOT be reacterable:

$ php artisan love:setup-reacterable --model="App\Models\User" --nullable


Manual migration creation described in Custom Setup Migrations.

  1. Run migration.
php artisan migrate

Creating Reacter Models

If you are integrating package on already existing user base you need to register your Reacterable models as Reacters.

php artisan love:register-reacters --model="App\Models\User"

This command will create Reacter model for each User model.