File manager - Edit - /var/www/ratemypay/app/Models/PostLike.php
Back
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\MorphTo; class PostLike extends Model { use HasFactory; protected $fillable = [ 'user_id', 'likeable_id', 'likeable_type', ]; public function user(): BelongsTo { return $this->belongsTo(User::class); } public function likeable(): MorphTo { return $this->morphTo(); } // Methods to handle likeable entities public function rateMyPay(): BelongsTo { return $this->belongsTo(RateMyPay::class, 'likeable_id') ->where('likeable_type', RateMyPay::class); } public function postComment(): BelongsTo { return $this->belongsTo(PostComment::class, 'likeable_id') ->where('likeable_type', PostComment::class); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings