Files
hatame.andarza09/app/Models/Favorite.php
T

52 lines
814 B
PHP

<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class Favorite
*
* @property int $id
* @property int $user_id
* @property string $favoritable_type
* @property int $favoritable_id
* @property Carbon|null $created_at
*
* @property User $user
*
* @package App\Models
*/
class Favorite extends Model
{
protected $table = 'favorites';
public $timestamps = false;
public static $snakeAttributes = false;
protected $casts = [
'user_id' => 'int',
'favoritable_id' => 'int'
];
protected $fillable = [
'user_id',
'favoritable_type',
'favoritable_id'
];
public function user()
{
return $this->belongsTo(User::class);
}
public function favoritable()
{
return $this->morphTo();
}
}