These docs are for v7. Click to read the latest docs for v9.

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:

<?php

namespace App;

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

class User extends Authenticatable implements ReacterableContract
{
    use Reacterable;
}

Database Changes

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

📘

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

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

📘

Manual migration creation described in Custom Setup Migrations.

  1. Run migration.
$ php artisan migrate