feat: add save feature
This commit is contained in:
+12
-8
@@ -5,9 +5,11 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\HasRatings;
|
||||
use App\Traits\HasComments;
|
||||
use App\Traits\HasSaves;
|
||||
|
||||
class Media extends Model
|
||||
{
|
||||
use HasRatings, HasComments;
|
||||
use HasRatings, HasComments,HasSaves;
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'image_id',
|
||||
@@ -21,16 +23,18 @@ class Media extends Model
|
||||
'visibility',
|
||||
'is_premium'
|
||||
];
|
||||
protected $appends = [
|
||||
'average_rating',
|
||||
protected $appends = [
|
||||
'average_rating',
|
||||
'user_rating',
|
||||
'ratings_count',
|
||||
'comments_count',
|
||||
'has_user_commented', // Add this
|
||||
'user_comment', // Add this
|
||||
'user_comment_id', // Add this
|
||||
'has_user_rated' // Add this
|
||||
];
|
||||
'has_user_commented',
|
||||
'user_comment',
|
||||
'user_comment_id',
|
||||
'has_user_rated',
|
||||
'is_saved',
|
||||
'saved_count'
|
||||
];
|
||||
public function image()
|
||||
{
|
||||
return $this->belongsTo(Image::class);
|
||||
|
||||
Reference in New Issue
Block a user