32 lines
631 B
PHP
32 lines
631 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use App\Contracts\Likerable;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||
|
|
use App\Traits\Haslike;
|
||
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||
|
|
|
||
|
|
class Liker extends Model implements Likerable
|
||
|
|
{
|
||
|
|
use Haslike;
|
||
|
|
use SoftDeletes;
|
||
|
|
protected $guarded = [];
|
||
|
|
public function likerable(): MorphTo
|
||
|
|
{
|
||
|
|
return $this->morphTo();
|
||
|
|
}
|
||
|
|
|
||
|
|
public function likerdable(): MorphTo
|
||
|
|
{
|
||
|
|
return $this->morphTo();
|
||
|
|
}
|
||
|
|
public function primaryId(): string
|
||
|
|
{
|
||
|
|
return (string)$this->getAttribute($this->primaryKey);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|