- Updated interaction models and relations for handling of user-deal interactions. - Added frontend interactivity with `interaction.js` for toggling like buttons.
28 lines
510 B
PHP
28 lines
510 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\InteractionType;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Interaction extends Model
|
|
{
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Deal::class);
|
|
}
|
|
|
|
public function deal(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Deal::class);
|
|
}
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'type' => InteractionType::class,
|
|
];
|
|
}
|
|
}
|