Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

app/Models/Instance/Emotion/Emotion.php

Open in GitHub
use Illuminate\Database\Eloquent\Model;
 
class Emotion extends Model
{
//
public function calls()
{
return $this->belongsToMany(Call::class, 'emotion_call', 'emotion_id', 'call_id')
->withPivot('account_id', 'contact_id')
->withTimestamps();
}
//
}

database/migrations/2018_12_09_145956_create_emotion_call_table.php

Open in GitHub
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
 
class CreateEmotionCallTable extends Migration
{
public function up()
{
Schema::create('emotion_call', function (Blueprint $table) {
$table->unsignedInteger('account_id');
$table->unsignedInteger('call_id');
$table->unsignedInteger('emotion_id');
$table->unsignedInteger('contact_id');
$table->timestamps();
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
$table->foreign('call_id')->references('id')->on('calls')->onDelete('cascade');
$table->foreign('emotion_id')->references('id')->on('emotions')->onDelete('cascade');
$table->foreign('contact_id')->references('id')->on('contacts')->onDelete('cascade');
});
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.