Files
karudhaas/app/Article.php

56 lines
947 B
PHP

<?php
namespace App;
use GoldSpecDigital\LaravelEloquentUUID\Database\Eloquent\Uuid;
use Illuminate\Database\Eloquent\Model;
use App\Source;
use App\Topic;
class Article extends Model
{
use Uuid;
/**
* The "type" of the auto-incrementing ID.
*
* @var string
*/
protected $keyType = 'string';
/**
* Indicates if the IDs are auto-incrementing.
*
* @var bool
*/
public $incrementing = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'body' => 'array',
'meta' => 'array'
];
public function source()
{
return $this->belongsTo(Source::class);
}
public function topics()
{
return $this->belongsToMany(Topic::class)->withTimestamps();
}
}