31 lines
540 B
PHP
31 lines
540 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Favorite extends Model
|
|
{
|
|
protected $fillable = [
|
|
'user_id',
|
|
'city_id',
|
|
];
|
|
|
|
/**
|
|
* Get the user that owns this favorite
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* Get the city that was favorited
|
|
*/
|
|
public function city(): BelongsTo
|
|
{
|
|
return $this->belongsTo(City::class);
|
|
}
|
|
}
|