2015-12-13 04:42:28 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
2015-12-14 13:22:39 +00:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2017-08-05 18:55:02 +00:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2022-11-08 17:38:28 +00:00
|
|
|
use Illuminate\Support\Carbon;
|
2015-12-13 04:42:28 +00:00
|
|
|
|
|
|
|
/**
|
2020-09-06 21:20:42 +00:00
|
|
|
* @property bool $liked
|
2021-06-05 10:47:56 +00:00
|
|
|
* @property int $play_count
|
2020-09-06 21:20:42 +00:00
|
|
|
* @property Song $song
|
|
|
|
* @property User $user
|
2021-06-05 10:47:56 +00:00
|
|
|
* @property int $id
|
2022-06-10 10:47:46 +00:00
|
|
|
* @property string $song_id
|
2022-11-08 17:38:28 +00:00
|
|
|
* @property Carbon|string $last_played_at
|
2015-12-13 04:42:28 +00:00
|
|
|
*/
|
|
|
|
class Interaction extends Model
|
|
|
|
{
|
2020-11-14 16:57:25 +00:00
|
|
|
use HasFactory;
|
2015-12-13 04:42:28 +00:00
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
'liked' => 'boolean',
|
|
|
|
'play_count' => 'integer',
|
|
|
|
];
|
2021-06-05 10:47:56 +00:00
|
|
|
|
2015-12-13 04:42:28 +00:00
|
|
|
protected $guarded = ['id'];
|
2022-11-08 17:38:28 +00:00
|
|
|
protected $hidden = ['id', 'user_id', 'created_at', 'updated_at', 'last_played_at'];
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2018-08-24 15:27:19 +00:00
|
|
|
public function user(): BelongsTo
|
2015-12-13 04:42:28 +00:00
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
}
|
|
|
|
|
2018-08-24 15:27:19 +00:00
|
|
|
public function song(): BelongsTo
|
2015-12-13 04:42:28 +00:00
|
|
|
{
|
|
|
|
return $this->belongsTo(Song::class);
|
|
|
|
}
|
|
|
|
}
|