Like APIの追加

This commit is contained in:
shibafu
2019-04-05 23:07:43 +09:00
parent 212fad4d66
commit 34b7cd6c89
5 changed files with 138 additions and 0 deletions

20
app/Like.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Like extends Model
{
protected $fillable = ['user_id', 'ejaculation_id'];
public function user()
{
return $this->belongsTo(User::class);
}
public function ejaculation()
{
return $this->belongsTo(Ejaculation::class)->withLikes();
}
}