43 lines
785 B
PHP
43 lines
785 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class Bookmark extends Model
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Indicates if the model should be timestamped.
|
||
|
|
*
|
||
|
|
* @var bool
|
||
|
|
*/
|
||
|
|
public $timestamps = false;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The attributes that are mass assignable.
|
||
|
|
*
|
||
|
|
* @var array<int, string>
|
||
|
|
*/
|
||
|
|
protected $fillable = [
|
||
|
|
'user_id',
|
||
|
|
'product_id',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the user that owns the bookmark.
|
||
|
|
*/
|
||
|
|
public function user(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(User::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the product that owns the bookmark.
|
||
|
|
*/
|
||
|
|
public function product(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Product::class);
|
||
|
|
}
|
||
|
|
}
|