34 lines
679 B
PHP
34 lines
679 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
class Card extends Model
|
|
{
|
|
protected $table = 'cards'; // Sabre table
|
|
public $timestamps = false;
|
|
protected $primaryKey = 'id';
|
|
|
|
protected $fillable = [
|
|
'addressbookid',
|
|
'uri',
|
|
'lastmodified',
|
|
'etag',
|
|
'size',
|
|
'carddata',
|
|
];
|
|
|
|
public function book()
|
|
{
|
|
return $this->belongsTo(Book::class, 'addressbookid');
|
|
}
|
|
|
|
public function meta(): HasOne
|
|
{
|
|
return $this->hasOne(CardMeta::class, 'card_id');
|
|
}
|
|
}
|